online multiplayer chess game (note server currently down)
Diffstat (limited to 'pieces/Knight.gd')
| -rw-r--r-- | pieces/Knight.gd | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/pieces/Knight.gd b/pieces/Knight.gd new file mode 100644 index 0000000..2ba7277 --- /dev/null +++ b/pieces/Knight.gd @@ -0,0 +1,28 @@ +class_name Knight +extends Piece + + +func get_moves(): + var moves = [ + pos_around(Vector2(-2, -1)), + pos_around(Vector2(-2, 1)), + pos_around(Vector2(2, -1)), + pos_around(Vector2(2, 1)), + pos_around(Vector2(-1, -2)), + pos_around(Vector2(1, -2)), + pos_around(Vector2(-1, 2)), + pos_around(Vector2(1, 2)) + ] + var final = [] + for i in moves: + if is_on_board(i): + if check_spots_check: + if !checkcheck(i): + continue + final.append(i) + return final + + +func _ready(): + ._ready() + shortname = "k" + team |