-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathClock.gd
More file actions
33 lines (27 loc) · 701 Bytes
/
Clock.gd
File metadata and controls
33 lines (27 loc) · 701 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
extends Node2D
var CountDownValue = 0
signal timer_done
func updateCountDown():
$CountDown.text = str(CountDownValue)
#func _ready():
# self.position = Vector2(200,200)
# self.scale = Vector2(0.5, 0.5)
# self.start(10)
func start(val):
CountDownValue = val
updateCountDown()
$Timer.start()
$AnimationPlayer.get_animation("Rotate").set_loop(true)
$AnimationPlayer.play("Rotate")
func stop():
$Timer.stop()
$AnimationPlayer.stop()
func _on_Timer_timeout():
CountDownValue -= 1
updateCountDown()
if CountDownValue <= 5:
$AnimationPlayer.get_animation("Rotate_Flash").set_loop(true)
$AnimationPlayer.play("Rotate_Flash")
if CountDownValue == 0:
stop()
emit_signal("timer_done")