chore: Flyer AnimTree activated, Cam timed offset for look around

This commit is contained in:
Jakob Feldmann 2023-06-12 21:56:38 +02:00
parent 23e30258b5
commit 3d8da994b6
2 changed files with 13 additions and 2 deletions

View File

@ -6,6 +6,7 @@ var camera_vertical_shift = 0
var right_move_time: float = 0
var left_move_time: float = 0
var slow_time: float = 0
var input_time: float = 0
var original_limit_left: int
var original_limit_right: int
var original_limit_bottom: int
@ -16,6 +17,7 @@ var target_offset: Vector2 = Vector2(0,0)
export var camera_horizontal_shift = 60
export var offset_reset_seconds := 1
export var offset_adapt_seconds := 1
export var offset_input_seconds := 0.618
onready var levelState := $"%LevelState"
onready var signalManager := $"%SignalManager"
@ -94,7 +96,7 @@ func _process(delta: float) -> void:
_adapt_to_movement(player_vel)
if abs(player_vel.x) <= blobby.max_velocity["walk"] * 0.9:
_adapt_to_input(player_vel)
_adapt_to_input(player_vel, delta)
position = blobby.position
prev_pos = position
_update_lighting_shader()
@ -167,9 +169,15 @@ func _adapt_to_movement(velocity: Vector2) -> void:
anim_player.play("shiftingCenter")
return
func _adapt_to_input(velocity: Vector2) -> void:
func _adapt_to_input(velocity: Vector2, delta: float) -> void:
# TODO Den bug dass man damit durch die map gucken kann wenn man sich weiter bewegt
# lasse ich erstmal drin
if(velocity.length() > 20.0):
input_time = 0
return
if(input_time < offset_input_seconds):
input_time += delta
return
if Input.is_action_pressed("duck"):
if(original_limit_bottom - position.y - 2 > screen_bottom.y && offset.y < 48):
offset.y += 1

View File

@ -222,8 +222,10 @@ valign = 1
[node name="FlyerSprite" type="Sprite" parent="."]
unique_name_in_owner = true
scale = Vector2( -1, 1 )
texture = ExtResource( 4 )
hframes = 2
frame = 1
[node name="AnimationPlayer" type="AnimationPlayer" parent="FlyerSprite"]
anims/RESET = SubResource( 33 )
@ -235,6 +237,7 @@ anims/searchingLeft = SubResource( 34 )
[node name="AnimationTree" type="AnimationTree" parent="FlyerSprite"]
tree_root = SubResource( 50 )
anim_player = NodePath("../AnimationPlayer")
active = true
root_motion_track = NodePath(".")
parameters/playback = SubResource( 51 )
parameters/hunting/blend_position = -1.04288