diff --git a/src/const.py b/src/const.py index 90be015..bfdf370 100644 --- a/src/const.py +++ b/src/const.py @@ -2,6 +2,7 @@ from pygame import image from config import main_path + WIDTH = 800 HEIGHT = 800 diff --git a/src/main.py b/src/main.py index 05de754..1bdad13 100644 --- a/src/main.py +++ b/src/main.py @@ -1,4 +1,4 @@ -import pygame +import pygame as pg from const import ICON from agent import Agent @@ -8,9 +8,9 @@ from environment import Environment def main(): - pygame.init() - pygame.display.set_caption('Super Saper') - pygame.display.set_icon(pygame.image.load(ICON)) + pg.init() + pg.display.set_caption('Super Saper') + pg.display.set_icon(pg.image.load(ICON)) env = Environment(DEFAULT_FIELD) agent = Agent() @@ -19,19 +19,19 @@ def main(): running = True while running: - for event in pygame.event.get(): - if event.type == pygame.QUIT: + for event in pg.event.get(): + if event.type == pg.QUIT: running = False - elif event.type == pygame.KEYDOWN: - if event.key == pygame.K_d and agent.x_px < 700: + elif event.type == pg.KEYDOWN: + if event.key == pg.K_d and agent.x*80 < 700: game_ui.move('x', 1) - elif event.key == pygame.K_a and agent.x_px > 5: + elif event.key == pg.K_a and agent.x*80 > 5: game_ui.move('x', -1) - elif event.key == pygame.K_s and agent.y_px < 700: + elif event.key == pg.K_s and agent.y*80 < 700: game_ui.move('y', 1) - elif event.key == pygame.K_w and agent.y_px > 0: + elif event.key == pg.K_w and agent.y*80 > 0: game_ui.move('y', -1) - elif event.key == pygame.K_SPACE: + elif event.key == pg.K_SPACE: if env.field[agent.y][agent.x] in [2, 3]: env.field[agent.y][agent.x] -= 2 game_ui.update()