2023-03-12 01:39:08 +01:00
|
|
|
import sys
|
|
|
|
import pygame
|
|
|
|
from .helpers import *
|
|
|
|
|
|
|
|
|
|
|
|
def initialize_interface(tiles_x, tiles_y):
|
2023-03-12 17:11:06 +01:00
|
|
|
|
|
|
|
size = width, height = 600, 600
|
2023-03-12 01:39:08 +01:00
|
|
|
screen = create_screen(size)
|
|
|
|
pygame.display.set_caption('Epic AI Vacuum Cleaner')
|
2023-03-12 17:11:06 +01:00
|
|
|
tile_width = width / tiles_x
|
|
|
|
tile_height = height / tiles_y
|
|
|
|
x = tile_width / 2
|
|
|
|
y = tile_height / 2
|
|
|
|
radius = 15
|
2023-03-12 01:39:08 +01:00
|
|
|
|
|
|
|
while True:
|
|
|
|
for event in pygame.event.get():
|
|
|
|
if event.type == pygame.QUIT:
|
|
|
|
sys.exit()
|
2023-03-12 17:11:06 +01:00
|
|
|
userInput = pygame.key.get_pressed()
|
|
|
|
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
|
|
|
|
|
|
|
|
pygame.time.delay(10)
|
|
|
|
pygame.display.update()
|
2023-03-12 01:39:08 +01:00
|
|
|
screen.fill(BLACK)
|
|
|
|
# rect(screen, WHITE, 50,50,90,90)
|
|
|
|
|
|
|
|
draw_board(screen, WHITE, width, height, tiles_x, tiles_y)
|
2023-03-12 17:11:06 +01:00
|
|
|
pygame.draw.circle(screen, (178, 172, 136), (int(x), int(y)), radius)
|
2023-03-12 01:39:08 +01:00
|
|
|
|
|
|
|
pygame.display.flip()
|