Compare commits

...

5 Commits

Author SHA1 Message Date
Nastassia Zhuravel 9c4b811c98 Merge pull request 'Moving-circle' (#3) from Moving-circle into main
Reviewed-on: #3
2023-03-12 18:22:26 +01:00
countingthedots edc78b9103 Moving circle added 2023-03-12 18:19:28 +01:00
countingthedots 7eb0a8b7fa Moving circle added 2023-03-12 18:15:15 +01:00
countingthedots 0580148281 Merge branch 'main' of https://git.wmi.amu.edu.pl/s473601/Machine_learning_2023 2023-03-12 17:14:53 +01:00
countingthedots 341e198749 Moving circle added 2023-03-12 17:11:06 +01:00
2 changed files with 23 additions and 8 deletions

View File

@ -32,8 +32,6 @@ class GridDraw():
self.screen = pygame.display.set_mode((self.width, self.height))
def start_draw(self):
for event in pygame.event.get():
if event.type == pygame.QUIT: sys.exit()
self.screen.fill(Colors.BLACK)
def end_draw(self):

View File

@ -1,14 +1,31 @@
from Interface.grid_draw import GridDraw, Colors
import sys
import pygame
# dummy function
def initial_draw():
grid = GridDraw(500, 500)
tile_width = 500 / 10
tile_height = 500 / 10
x = tile_width / 2
y = tile_height / 2
radius = 15
while True:
grid.start_draw()
grid.board(10, 10)
grid.circle(75, 75, 20, color=Colors.RED)
grid.circle(225, 175, 20, color=Colors.GREEN)
grid.end_draw()
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
x -= tile_width
if event.key == pygame.K_RIGHT:
x += tile_width
if event.key == pygame.K_UP:
y -= tile_height
if event.key == pygame.K_DOWN:
y += tile_height
grid.circle(x, y, 20, color=Colors.RED)
grid.end_draw()
pygame.time.delay(10)