diff --git a/gameContext.py b/gameContext.py index 927dfd7..a59e292 100644 --- a/gameContext.py +++ b/gameContext.py @@ -4,9 +4,9 @@ class GameContext: dust_car_speed = 20 dust_car_position_x = 0 dust_car_position_y = 0 - stick_man_pygame = None - stick_man_pil = None + dust_car_pygame = None + dust_car_pil = None canvas = None def startup(game_context: GameContext): - game_context.canvas.blit(game_context.stick_man_pygame, (game_context.dust_car_position_x, game_context.dust_car_position_y)) + game_context.canvas.blit(game_context.dust_car_pygame, (game_context.dust_car_position_x, game_context.dust_car_position_y)) diff --git a/gameEventHandler.py b/gameEventHandler.py index 6014365..479fb9e 100644 --- a/gameEventHandler.py +++ b/gameEventHandler.py @@ -8,7 +8,7 @@ def handle_game_event(event, game_context: GameContext): def dust_car_movement(event, game_context:GameContext): if event.type != pygame.KEYDOWN: return - (width, height) = game_context.stick_man_pil.size + (width, height) = game_context.dust_car_pil.size if event.key == pygame.K_LEFT: pygame.draw.rect(game_context.canvas, (0, 0, 0), (game_context.dust_car_position_x, game_context.dust_car_position_y, width, height)) game_context.dust_car_position_x -= game_context.dust_car_speed @@ -21,4 +21,4 @@ def dust_car_movement(event, game_context:GameContext): elif event.key == pygame.K_DOWN: pygame.draw.rect(game_context.canvas, (0, 0, 0), (game_context.dust_car_position_x, game_context.dust_car_position_y, width, height)) game_context.dust_car_position_y += game_context.dust_car_speed - game_context.canvas.blit(game_context.stick_man_pygame, (game_context.dust_car_position_x, game_context.dust_car_position_y)) + game_context.canvas.blit(game_context.dust_car_pygame, (game_context.dust_car_position_x, game_context.dust_car_position_y)) diff --git a/imgs/stickMan.jpg b/imgs/stickMan.jpg deleted file mode 100644 index 8871b54..0000000 Binary files a/imgs/stickMan.jpg and /dev/null differ diff --git a/main.py b/main.py index c1882ae..0084bd5 100644 --- a/main.py +++ b/main.py @@ -9,11 +9,11 @@ pygame.init() canvas = pygame.display.set_mode((800, 800)) pygame.display.set_caption("Inteligentna śmieciarka") -stick_man_pil = Image.open('imgs/stickMan.jpg') +dust_car_pil = Image.open('imgs/dust_car.png') game_context = GameContext() -game_context.stick_man_pil = stick_man_pil -game_context.stick_man_pygame = pygame.image.frombuffer(stick_man_pil.tobytes(), stick_man_pil.size, 'RGB') +game_context.dust_car_pil = dust_car_pil +game_context.dust_car_pygame = pygame.image.frombuffer(dust_car_pil.tobytes(), dust_car_pil.size, 'RGB') game_context.canvas = canvas startup(game_context)