online multiplayer chess game (note server currently down)
Diffstat (limited to 'pieces/Pawn.gd')
| -rw-r--r-- | pieces/Pawn.gd | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/pieces/Pawn.gd b/pieces/Pawn.gd index 7760913..3e7e8d9 100644 --- a/pieces/Pawn.gd +++ b/pieces/Pawn.gd @@ -1,10 +1,11 @@ extends Piece -class_name Pawn +class_name Pawn, "res://assets/california/wP.png" + +onready var whiteint = 1 if white else -1 func get_moves(): var points = [Vector2.UP, Vector2.UP * 2] - var whiteint = 1 if white else -1 var moves = [] for i in range(len(points)): var point = points[i] @@ -22,7 +23,6 @@ func get_moves(): func get_attacks(): var points = [Vector2.UP + Vector2.RIGHT, Vector2.UP + Vector2.LEFT] - var whiteint = int(white) var moves = [] for i in range(len(points)): var point = points[i] @@ -30,6 +30,8 @@ func get_attacks(): point = pos_around(point) if !is_on_board(point): continue + if check_spots_check and checkcheck(point): + continue if at_pos(point) != null and at_pos(point).white != white: moves.append(point) return moves |