online multiplayer chess game (note server currently down)
-rw-r--r--Events.gd1
-rw-r--r--Grid.gd2
-rw-r--r--ui/TimerLabels.gd5
3 files changed, 8 insertions, 0 deletions
diff --git a/Events.gd b/Events.gd
index 307593f..1a7cfa9 100644
--- a/Events.gd
+++ b/Events.gd
@@ -4,3 +4,4 @@ extends Node
signal turn_over
signal just_before_turn_over # called just before turn over
signal outoftime # called when the time is up
+signal game_over # called when the game is over
diff --git a/Grid.gd b/Grid.gd
index 43f86db..605840c 100644
--- a/Grid.gd
+++ b/Grid.gd
@@ -121,6 +121,7 @@ func _on_turn_over():
func drawed():
+ Events.emit_signal("game_over")
SoundFx.play("Draw")
print_matrix_pretty()
yield(get_tree().create_timer(5), "timeout")
@@ -129,6 +130,7 @@ func drawed():
func win(winner):
+ Events.emit_signal("game_over")
print(winner, " won the game in ", Globals.turns(winner), " turns!")
SoundFx.play("Victory")
print_matrix_pretty()
diff --git a/ui/TimerLabels.gd b/ui/TimerLabels.gd
index cfd2c7b..764c827 100644
--- a/ui/TimerLabels.gd
+++ b/ui/TimerLabels.gd
@@ -27,6 +27,11 @@ func _ready():
colorrect.show_behind_parent = true
colorrect.color = Globals.grid.overlay_color
Events.connect("turn_over", self, "_on_turn_over")
+ Events.connect("game_over", self, "_on_game_over")
+
+
+func _on_game_over():
+ stop = true
func _on_turn_over():