online multiplayer chess game (note server currently down)
Diffstat (limited to 'Globals.gd')
-rw-r--r--Globals.gd33
1 files changed, 20 insertions, 13 deletions
diff --git a/Globals.gd b/Globals.gd
index d6433d0..43f0c67 100644
--- a/Globals.gd
+++ b/Globals.gd
@@ -1,9 +1,12 @@
extends Node
+var __nosethalfmove = false
+
+var pawns = [] # PoolPawnArray
var grid: Grid = null
var piece_set := "california"
-var white_turns := 0
-var black_turns := 0
+var fullmove := 1
+var halfmove := 0
var in_check := false
var checking_piece: Piece = null
var white_king: King
@@ -12,19 +15,23 @@ 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 turns(_winner) -> int:
+ return fullmove
+
+
+func reset_halfmove() -> void:
+ halfmove = 0
+ __nosethalfmove = true
-func add_turn():
- if turn:
- white_turns += 1
- else:
- black_turns += 1
+func add_turn() -> void:
+ if !turn:
+ fullmove += 1
+ if __nosethalfmove:
+ __nosethalfmove = false
+ return
+ halfmove += 1
-func _ready():
+func _ready() -> void:
VisualServer.set_default_clear_color(Color.black)