summaryrefslogtreecommitdiff
path: root/Scripts/Mask/SpeedMask.gd
diff options
context:
space:
mode:
Diffstat (limited to 'Scripts/Mask/SpeedMask.gd')
-rw-r--r--Scripts/Mask/SpeedMask.gd36
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