17 lines
No EOL
640 B
GDScript
17 lines
No EOL
640 B
GDScript
extends "res://Systems/StateMachine/ChessGameState.gd"
|
|
|
|
func enter(_previous: String, _data := {}) -> void:
|
|
game.resetHighlights()
|
|
if game.selectedNode != "":
|
|
game.getValidMoves()
|
|
|
|
func handleMovement(location: String) -> void:
|
|
var node = game.get_node("Flow/" + location)
|
|
if game.selectedNode == "":
|
|
if node.get_child_count() != 0 && node.get_child(0).Item_Color == game.Turn:
|
|
game.selectedNode = location
|
|
game.getMovableAreas()
|
|
else:
|
|
if game.isValidMove(location):
|
|
game.executeMove(location)
|
|
finished.emit(Constants.POST_MOVE) |