Fix FOV and sink block

This commit is contained in:
Spencer Killen 2022-12-11 18:07:05 -07:00
parent dc7e309ef2
commit 103b3bf74a
Signed by: sjkillen
GPG Key ID: F307025B65C860BA
4 changed files with 15 additions and 7 deletions

View File

@ -2,9 +2,13 @@ extends Node
onready var OnFootPhysics = get_node("../../../../../OnFootPhysics") onready var OnFootPhysics = get_node("../../../../../OnFootPhysics")
onready var Floor = get_node("../../../../../OnFootPhysics/Floor") onready var Floor = get_node("../../../../../OnFootPhysics/Floor")
var has_played = false
func _process(_delta): func _process(_delta):
if OnFootPhysics.velocity.y >= 0.0 or Floor.is_on_floor: if OnFootPhysics.is_falling_terminally:
$FOVAnimation.play("RESET") if has_played:
return
$FOVAnimation.play("fov") $FOVAnimation.play("fov")
has_played = true
return
has_played = false
$FOVAnimation.play("RESET")

View File

@ -66,7 +66,7 @@ func process_velocity(delta: float):
target_velocity_xz *= sprint_factor target_velocity_xz *= sprint_factor
else: else:
target_velocity_xz *= walk_factor target_velocity_xz *= walk_factor
target_velocity = util.vec2_xz_to_vec3(target_velocity_xz, target_velocity.y) target_velocity = util.vec2_xz_to_vec3(target_velocity_xz, target_velocity.y) * velocity_factor
var velocity_xz = util.vec3_xz(velocity) var velocity_xz = util.vec3_xz(velocity)
@ -88,8 +88,8 @@ func process_velocity(delta: float):
var velocity_y = util.clamped_lerp(velocity.y, target_velocity.y, y_weight, 0.25) var velocity_y = util.clamped_lerp(velocity.y, target_velocity.y, y_weight, 0.25)
velocity = util.vec2_xz_to_vec3(velocity_xz, velocity_y)
velocity = util.vec2_xz_to_vec3(velocity_xz, velocity_y) * velocity_factor
func process_falling(): func process_falling():
if not $Floor.is_on_floor: if not $Floor.is_on_floor:

View File

@ -2,7 +2,7 @@ extends Node
onready var global_event_bus = get_node("/root/GlobalEventBus") onready var global_event_bus = get_node("/root/GlobalEventBus")
var sink_counter = 0 var sink_counter = 0
export var SINK_BLOCK_SLOWDOWN_AMOUNT = Vector3(0.7, 0.1, 0.7) export var SINK_BLOCK_SLOWDOWN_AMOUNT = Vector3(0.7, 0.01, 0.7)
func _ready(): func _ready():
global_event_bus.connect("player_entered_meat_sink", self, "on_player_enter_meat_sink") global_event_bus.connect("player_entered_meat_sink", self, "on_player_enter_meat_sink")

View File

@ -1,6 +1,7 @@
[gd_scene load_steps=4 format=2] [gd_scene load_steps=5 format=2]
[ext_resource path="res://player/player.tscn" type="PackedScene" id=1] [ext_resource path="res://player/player.tscn" type="PackedScene" id=1]
[ext_resource path="res://effects/SinkBlock.tscn" type="PackedScene" id=2]
[sub_resource type="CubeMesh" id=1] [sub_resource type="CubeMesh" id=1]
@ -38,3 +39,6 @@ shape = SubResource( 2 )
[node name="Player" parent="." instance=ExtResource( 1 )] [node name="Player" parent="." instance=ExtResource( 1 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.271765, 0 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.271765, 0 )
[node name="SinkBlock" parent="." instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 0.264811, 0, 0, 0, 1, 2.72806, -22.0505, 0 )