progress
This commit is contained in:
parent
c7bf4a5334
commit
a59412eb60
1 changed files with 18 additions and 0 deletions
18
game.gd
18
game.gd
|
@ -120,6 +120,9 @@ func UpdateGame(cell):
|
|||
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():
|
||||
# Clearing the arrays
|
||||
|
@ -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!");
|
||||
|
|
Loading…
Add table
Reference in a new issue