enabled enforced static typing

This commit is contained in:
2024-02-22 06:22:22 +11:00
parent e1a867d2a9
commit a93660f755
1645 changed files with 24730 additions and 2078 deletions

View File

@@ -1,9 +1,9 @@
extends Sprite2D
#var head_bob_amplitude := 100.0
@export var head_bob_amplitude := 50.0
@export var head_bob_amplitude: float = 50.0
#var head_bob_amplitude := 1.0
@export var head_bob_frequency := 0.015
@export var head_bob_frequency: float = 0.015
#var head_bob_frequency := 0.030
@@ -11,27 +11,27 @@ func _process(delta: float) -> void:
check_motion(delta)
func check_motion(delta) -> void:
func check_motion(delta: float) -> void:
if Input.is_action_pressed("Primary Fire"):
play_motion(foot_step_motion(), delta)
else:
reset_position(delta)
func reset_position(delta) -> void:
func reset_position(delta: float) -> void:
if position != Vector2.ZERO:
position = lerp(position, Vector2.ZERO, 10.0 * delta)
func foot_step_motion() -> Vector2:
var pos := Vector2.ZERO
var t = Time.get_ticks_msec() * head_bob_frequency
var pos: Vector2 = Vector2.ZERO
var t: float = Time.get_ticks_msec() * head_bob_frequency
pos.y += sin(t) * head_bob_amplitude
pos.x += cos(t / 2.0) * head_bob_amplitude * 2.0
return pos
func play_motion(motion: Vector2, delta) -> void:
func play_motion(motion: Vector2, delta: float) -> void:
position = lerp(position, motion, 10.0 * delta)
#position = motion
#position += motion