online multiplayer chess game (note server currently down)
Diffstat (limited to 'pieces/N.gd')
-rw-r--r--pieces/N.gd24
1 files changed, 24 insertions, 0 deletions
diff --git a/pieces/N.gd b/pieces/N.gd
new file mode 100644
index 0000000..dfb05c8
--- /dev/null
+++ b/pieces/N.gd
@@ -0,0 +1,24 @@
+extends Piece
+class_name Knight, "res://assets/pieces/california/wN.png"
+
+
+func get_moves(no_enemys := false, check_spots_check := true) -> PoolVector2Array:
+ var moves: PoolVector2Array = [
+ 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: PoolVector2Array = []
+ for i in moves:
+ if is_on_board(i):
+ if no_enemys and at_pos(i):
+ continue
+ if check_spots_check and checkcheck(i):
+ continue
+ final.append(i)
+ return final