mostly working, need netcode, en passant, and castling
This commit is contained in:
25
Queen.gd
Normal file
25
Queen.gd
Normal file
@@ -0,0 +1,25 @@
|
||||
extends "res://Piece.gd"
|
||||
|
||||
|
||||
func setup():
|
||||
kind = KIND.QUEEN
|
||||
var sprite2d = get_node("Sprite2D")
|
||||
if team == TEAM.WHITE:
|
||||
sprite2d.region_rect = Rect2(48, 4, 39, 36)
|
||||
elif team == TEAM.BLACK:
|
||||
sprite2d.region_rect = Rect2(48, 50, 39, 37)
|
||||
|
||||
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
|
||||
|
||||
if !path_empty(destination):
|
||||
return false
|
||||
|
||||
var dx = abs(destination.x - grid_pos.x)
|
||||
var dy = abs(destination.y - grid_pos.y)
|
||||
var straight = min(dx, dy) == 0 and max(dx, dy) > 0
|
||||
var diagonal = dx == dy and dx > 0
|
||||
return straight or diagonal
|
||||
Reference in New Issue
Block a user