diff --git a/src/agent.py b/src/agent.py index 25156b7..d9e860c 100644 --- a/src/agent.py +++ b/src/agent.py @@ -1,10 +1,11 @@ from const import SAPPER_IDLE +import pygame as pg class Agent: def __init__(self, x: int = 0, y: int = 0): self.name = "Kapitan Bomba" - self.img = SAPPER_IDLE + self.img = pg.image.load(SAPPER_IDLE[1]) self.dir = 1 self.x = x self.y = y diff --git a/src/const.py b/src/const.py index 4b0208c..5212b40 100644 --- a/src/const.py +++ b/src/const.py @@ -37,7 +37,13 @@ for name, val in { ) ICON = main_path + '/images/mine_icon.png' -SAPPER_IDLE = pg.image.load(main_path + '/images/sapper_idle/agent.png') +SAPPER_IDLE = [main_path + '/images/sapper_idle/agent0.png', + main_path + '/images/sapper_idle/agent1.png', + main_path + '/images/sapper_idle/agent2.png', + main_path + '/images/sapper_idle/agent3.png'] + + +#pg.image.load(main_path + '/images/sapper_idle/agent1.png') #empty space diff --git a/src/game_ui.py b/src/game_ui.py index 8768379..b0184fa 100644 --- a/src/game_ui.py +++ b/src/game_ui.py @@ -1,4 +1,6 @@ import pygame as pg +import os +main_path = os.path.dirname(os.getcwd()) from agent import Agent from environment import Environment @@ -25,7 +27,6 @@ class GameUi: ) self.update() self.clock.tick(15) - self.agent.img = SAPPER_IDLE self.update() def update(self): @@ -38,4 +39,7 @@ class GameUi: def rotate(self, dir): self.agent.dir = (self.agent.dir + dir) % 4 print(self.agent.dir) + self.agent.img = pg.image.load(SAPPER_IDLE[self.agent.dir]) + self.update() +