mostly working, need netcode, en passant, and castling
This commit is contained in:
18
King.gd
Normal file
18
King.gd
Normal file
@@ -0,0 +1,18 @@
|
||||
extends "res://Piece.gd"
|
||||
|
||||
func setup():
|
||||
kind = KIND.KING
|
||||
var sprite2d = get_node("Sprite2D")
|
||||
if team == TEAM.WHITE:
|
||||
sprite2d.region_rect = Rect2(5, 5, 35, 36)
|
||||
elif team == TEAM.BLACK:
|
||||
sprite2d.region_rect = Rect2(5, 50, 35, 36)
|
||||
|
||||
func check_move(destination: Vector2i) -> bool:
|
||||
var board_state = get_board_state()
|
||||
if board_state.has(destination):
|
||||
if board_state[destination].team == team:
|
||||
return false
|
||||
# TODO castling
|
||||
|
||||
return abs(destination.x - grid_pos.x) + abs(destination.y - grid_pos.y) == 1
|
||||
Reference in New Issue
Block a user