From a59412eb6066cf8095f35c785d883d6696012eee Mon Sep 17 00:00:00 2001 From: CatAClock Date: Mon, 9 Jun 2025 13:38:06 -0700 Subject: [PATCH] progress --- game.gd | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/game.gd b/game.gd index 6e4bf98..6e376f1 100644 --- a/game.gd +++ b/game.gd @@ -119,6 +119,9 @@ func UpdateGame(cell): cell.get_child(0).Castling = false if cell.get_child(0).name == "Rook": cell.get_child(0).Castling = false + + # King checking. + CheckKing(things) # Below is the movement that is used for the pieces func GetMovableAreas(): @@ -378,4 +381,19 @@ func IsNull(Location): if Flow.get_node_or_null(Location) == null: return true else: + IsKing(Location) return false + +# Checking for a king. +func CheckKing(Children): + for i in Children: + if not IsNull(i.get_path()): + SelectedNode = str(i.name) + print(SelectedNode) + GetMovableAreas() + +# Helper function +func IsKing(Location): + var TheNode = Flow.get_node_or_null(Location) + if TheNode != null && TheNode.get_child_count() != 0 && TheNode.get_child(0).PieceColor != Turn && TheNode.get_child(0).name == "King": + print("Check!");