Fixed radius value

This commit is contained in:
countingthedots 2023-03-19 19:53:54 +01:00
parent ef2e1a1fb7
commit 8d9c4146a4
2 changed files with 5 additions and 4 deletions

View File

@ -53,7 +53,7 @@ class GridDraw:
self.line(0, tiles_height * i, self.width, tiles_height * i, color=color)
@default_color
def circle(self, x, y, color=None):
def circle(self, x, y, radius, color=None):
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.

View File

@ -16,18 +16,19 @@ def initial_draw(grid_dimensions, board_size):
grid_height = grid_dimensions
# FIXME @countingthedots: please tell me what is going on there and why???
#
grid = GridDraw(grid_width, grid_height)
tile_width = grid_width / board_size
tile_height = grid_height / board_size
x = tile_width / 2
y = tile_height / 2
radius = 20
radius = tile_height/3
# rendering loop
while True:
grid.start_draw()
grid.board(board_size, board_size)
(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()
pygame.time.delay(10)