Merge pull request 'Fixed radius value' (#6) from radiusFixed into main
Reviewed-on: #6
This commit is contained in:
commit
4ec034d548
@ -53,7 +53,7 @@ class GridDraw:
|
|||||||
self.line(0, tiles_height * i, self.width, tiles_height * i, color=color)
|
self.line(0, tiles_height * i, self.width, tiles_height * i, color=color)
|
||||||
|
|
||||||
@default_color
|
@default_color
|
||||||
def circle(self, x, y, color=None):
|
def circle(self, x, y, radius, color=None):
|
||||||
pygame.draw.circle(
|
pygame.draw.circle(
|
||||||
self.screen, color, (x, y), 20
|
self.screen, color, (x, y), radius
|
||||||
) # TODO calculate radius (now 20) in terms of window size.
|
) # TODO calculate radius (now 20) in terms of window size.
|
||||||
|
@ -16,18 +16,19 @@ def initial_draw(grid_dimensions, board_size):
|
|||||||
grid_height = grid_dimensions
|
grid_height = grid_dimensions
|
||||||
|
|
||||||
# FIXME @countingthedots: please tell me what is going on there and why???
|
# FIXME @countingthedots: please tell me what is going on there and why???
|
||||||
|
#
|
||||||
grid = GridDraw(grid_width, grid_height)
|
grid = GridDraw(grid_width, grid_height)
|
||||||
tile_width = grid_width / board_size
|
tile_width = grid_width / board_size
|
||||||
tile_height = grid_height / board_size
|
tile_height = grid_height / board_size
|
||||||
x = tile_width / 2
|
x = tile_width / 2
|
||||||
y = tile_height / 2
|
y = tile_height / 2
|
||||||
radius = 20
|
radius = tile_height/3
|
||||||
|
|
||||||
# rendering loop
|
# rendering loop
|
||||||
while True:
|
while True:
|
||||||
grid.start_draw()
|
grid.start_draw()
|
||||||
grid.board(board_size, board_size)
|
grid.board(board_size, board_size)
|
||||||
(x, y) = robot_movement(grid_width, grid_height, tile_width, tile_height, x, y)
|
(x, y) = robot_movement(grid_width, grid_height, tile_width, tile_height, x, y)
|
||||||
grid.circle(x, y, color=Colors.RED)
|
grid.circle(x, y, radius, color=Colors.RED)
|
||||||
grid.end_draw()
|
grid.end_draw()
|
||||||
pygame.time.delay(10)
|
pygame.time.delay(10)
|
||||||
|
Loading…
Reference in New Issue
Block a user