added capturing circle around possible capture for
legal moves
This commit is contained in:
parent
a3b7df4e4c
commit
d7863e0d81
@ -90,17 +90,29 @@ class GUI(View):
|
|||||||
if selected_piece is not None:
|
if selected_piece is not None:
|
||||||
possible_positions = [move.pos for move in legal_moves]
|
possible_positions = [move.pos for move in legal_moves]
|
||||||
if pos in possible_positions:
|
if pos in possible_positions:
|
||||||
radius = .15 * self.tile_size
|
|
||||||
colour = circle_colours[(x + y) % 2]
|
colour = circle_colours[(x + y) % 2]
|
||||||
self.canvas.create_oval(
|
move = [move for move in legal_moves if move.pos == pos][0]
|
||||||
(x + .5) * self.tile_size - radius,
|
if move.is_capturing:
|
||||||
(y + .5) * self.tile_size - radius,
|
radius = .40 * self.tile_size
|
||||||
(x + .5) * self.tile_size + radius,
|
self.canvas.create_oval(
|
||||||
(y + .5) * self.tile_size + radius,
|
(x + .5) * self.tile_size - radius,
|
||||||
fill=colour,
|
(y + .5) * self.tile_size - radius,
|
||||||
outline=colour,
|
(x + .5) * self.tile_size + radius,
|
||||||
)
|
(y + .5) * self.tile_size + radius,
|
||||||
|
fill="",
|
||||||
|
outline=colour,
|
||||||
|
width=.075 * self.tile_size,
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
radius = .15 * self.tile_size
|
||||||
|
self.canvas.create_oval(
|
||||||
|
(x + .5) * self.tile_size - radius,
|
||||||
|
(y + .5) * self.tile_size - radius,
|
||||||
|
(x + .5) * self.tile_size + radius,
|
||||||
|
(y + .5) * self.tile_size + radius,
|
||||||
|
fill=colour,
|
||||||
|
outline=colour,
|
||||||
|
)
|
||||||
|
|
||||||
piece = board.piece_at(x, 7-y)
|
piece = board.piece_at(x, 7-y)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user