online multiplayer chess game (note server currently down)
Diffstat (limited to 'pieces/King.gd')
| -rw-r--r-- | pieces/King.gd | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/pieces/King.gd b/pieces/King.gd new file mode 100644 index 0000000..4c2c9d1 --- /dev/null +++ b/pieces/King.gd @@ -0,0 +1,25 @@ +extends Piece +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)) + ] + var final = [] + for i in moves: + if .is_on_board(i): + final.append(i) + return final + + +func _ready(): + ._ready() + shortname = "k" + team |