diff options
| author | altaf-creator <dev@altafcreator.com> | 2025-10-20 01:43:48 +0800 |
|---|---|---|
| committer | altaf-creator <dev@altafcreator.com> | 2025-10-20 01:43:48 +0800 |
| commit | 466bec0b724632f6dd2e1555a7bd58ffc1dd0458 (patch) | |
| tree | d6645ea11914edeec645299fa497a9e542dbaec7 /Scripts/Mask/SpeedMask.gd | |
Jam version.
Diffstat (limited to 'Scripts/Mask/SpeedMask.gd')
| -rw-r--r-- | Scripts/Mask/SpeedMask.gd | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/Scripts/Mask/SpeedMask.gd b/Scripts/Mask/SpeedMask.gd new file mode 100644 index 0000000..682785a --- /dev/null +++ b/Scripts/Mask/SpeedMask.gd @@ -0,0 +1,36 @@ +extends Node2D + +var player_movement : PlayerMovement + +var timer : Timer + +var just_clicked : bool = false + +var can_dash : bool = true + +func _ready() -> void: + player_movement = get_node("../../PlayerMovement") + timer = Timer.new() + timer.wait_time = .5 + timer.one_shot = true + timer.timeout.connect(_timeout) + add_child(timer) + +func _input(_event: InputEvent) -> void: +# if Input.is_action_just_pressed("left") || Input.is_action_just_pressed("right"): +# if !just_clicked: +# just_clicked = true +# timer.start() +# else: +# just_clicked = false + if Input.is_action_just_pressed("dash"): + if can_dash: + player_movement.dash(Input.get_axis("left", "right")) + can_dash = false + $"Cooldown".start() + +func _timeout() -> void: + just_clicked = false + +func _on_cooldown_timeout() -> void: + can_dash = true |
