online multiplayer chess game (note server currently down)
Diffstat (limited to 'pieces/King.gd')
| -rw-r--r-- | pieces/King.gd | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/pieces/King.gd b/pieces/King.gd index 4c2c9d1..8f4ce4b 100644 --- a/pieces/King.gd +++ b/pieces/King.gd @@ -4,18 +4,21 @@ class_name King func get_moves(): var moves = [ - .pos_around(Vector2.UP), - .pos_around(Vector2.DOWN), - .pos_around(Vector2.LEFT), - .pos_around(Vector2.RIGHT), - .pos_around(Vector2(1, 1)), - .pos_around(Vector2(1, -1)), - .pos_around(Vector2(-1, 1)), - .pos_around(Vector2(-1, -1)) + pos_around(Vector2.UP), + pos_around(Vector2.DOWN), + pos_around(Vector2.LEFT), + pos_around(Vector2.RIGHT), + pos_around(Vector2(1, 1)), + pos_around(Vector2(1, -1)), + pos_around(Vector2(-1, 1)), + pos_around(Vector2(-1, -1)) ] var final = [] for i in moves: - if .is_on_board(i): + if is_on_board(i): + if check_spots_check: + if !checkcheck(i): + continue final.append(i) return final |