diff options
author | Henrique Alves <henrique.alves@itsjungle.xyz> | 2024-01-28 12:59:06 +0200 |
---|---|---|
committer | Henrique Alves <henrique.alves@itsjungle.xyz> | 2024-01-28 13:00:10 +0200 |
commit | 5aa179deaa7cfc35b5bbc6abfba348deb0cc7017 (patch) | |
tree | 3439c6eccc415a10c4c4f7bef1fcb0538a4de9d7 /game/shared/scripts/microgame.gd | |
parent | 40e31067f724d7a0570d622cc4d4dc0ee7233275 (diff) | |
download | gamejam-ggj-2024-5aa179deaa7cfc35b5bbc6abfba348deb0cc7017.tar.gz gamejam-ggj-2024-5aa179deaa7cfc35b5bbc6abfba348deb0cc7017.tar.bz2 gamejam-ggj-2024-5aa179deaa7cfc35b5bbc6abfba348deb0cc7017.zip |
Add timer
Diffstat (limited to 'game/shared/scripts/microgame.gd')
-rw-r--r-- | game/shared/scripts/microgame.gd | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/game/shared/scripts/microgame.gd b/game/shared/scripts/microgame.gd index cde93ba..1f38842 100644 --- a/game/shared/scripts/microgame.gd +++ b/game/shared/scripts/microgame.gd @@ -10,16 +10,21 @@ enum MICROGAME_CONTROL {HEAD_ON_KEYBOARD, INVERTED_HAND, ONLY_PINKY} @export var instructions = "" @export var win_on_timeout = true +var _timer: Timer + signal finished(won) +func get_time_left(): + return _timer.time_left + func _ready(): - var timer = Timer.new() - add_child(timer) - timer.one_shot = true - timer.start(MICROGAME_TIMER) + _timer = Timer.new() + add_child(_timer) + _timer.one_shot = true + _timer.start(MICROGAME_TIMER) - timer.timeout.connect(func(): + _timer.timeout.connect(func(): finished.emit(win_on_timeout) ) |