Refactor #4

Merged
s473566 merged 4 commits from Refactor into main 2023-03-12 20:15:06 +01:00
Showing only changes of commit 9db0cc3cfd - Show all commits

17
Interface/movement.py Normal file
View File

@ -0,0 +1,17 @@
import pygame
import sys
def moving_cleaner(grid_width, grid_height,tile_width,tile_height, x, y):
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT and x>(tile_width / 2):
x -= tile_width
if event.key == pygame.K_RIGHT and x<(grid_width-(tile_width / 2)):
x += tile_width
if event.key == pygame.K_UP and y>(tile_height / 2):
y -= tile_height
if event.key == pygame.K_DOWN and y<(grid_height-(tile_height / 2)):
y += tile_height
return(x,y)