online multiplayer chess game (note server currently down)
Diffstat (limited to 'Globals.gd')
-rw-r--r--Globals.gd17
1 files changed, 16 insertions, 1 deletions
diff --git a/Globals.gd b/Globals.gd
index e5c0dce..09b9c2c 100644
--- a/Globals.gd
+++ b/Globals.gd
@@ -1,10 +1,25 @@
extends Node
var grid: Grid = null
-var turns := 0
+var white_turns := 0
+var black_turns := 0
var in_check = false
var checking_piece: Piece = null
var white_king: King
var black_king: King
var turn := true # true for white, false for black
# true cuz white goes first
+
+
+func turns(winner):
+ if winner == "white":
+ return white_turns
+ elif winner == "black":
+ return black_turns
+
+
+func add_turn():
+ if turn:
+ white_turns += 1
+ else:
+ black_turns += 1