Scal SuperSaperTestowy #1
@ -1,10 +1,11 @@
|
|||||||
from const import SAPPER_IDLE
|
from const import SAPPER_IDLE
|
||||||
|
import pygame as pg
|
||||||
|
|
||||||
|
|
||||||
class Agent:
|
class Agent:
|
||||||
def __init__(self, x: int = 0, y: int = 0):
|
def __init__(self, x: int = 0, y: int = 0):
|
||||||
self.name = "Kapitan Bomba"
|
self.name = "Kapitan Bomba"
|
||||||
self.img = SAPPER_IDLE
|
self.img = pg.image.load(SAPPER_IDLE[1])
|
||||||
self.dir = 1
|
self.dir = 1
|
||||||
self.x = x
|
self.x = x
|
||||||
self.y = y
|
self.y = y
|
||||||
|
@ -37,7 +37,13 @@ for name, val in {
|
|||||||
)
|
)
|
||||||
|
|
||||||
ICON = main_path + '/images/mine_icon.png'
|
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
|
#empty space
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
import pygame as pg
|
import pygame as pg
|
||||||
|
import os
|
||||||
|
main_path = os.path.dirname(os.getcwd())
|
||||||
|
|
||||||
from agent import Agent
|
from agent import Agent
|
||||||
from environment import Environment
|
from environment import Environment
|
||||||
@ -25,7 +27,6 @@ class GameUi:
|
|||||||
)
|
)
|
||||||
self.update()
|
self.update()
|
||||||
self.clock.tick(15)
|
self.clock.tick(15)
|
||||||
self.agent.img = SAPPER_IDLE
|
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
def update(self):
|
def update(self):
|
||||||
@ -38,4 +39,7 @@ class GameUi:
|
|||||||
def rotate(self, dir):
|
def rotate(self, dir):
|
||||||
self.agent.dir = (self.agent.dir + dir) % 4
|
self.agent.dir = (self.agent.dir + dir) % 4
|
||||||
print(self.agent.dir)
|
print(self.agent.dir)
|
||||||
|
self.agent.img = pg.image.load(SAPPER_IDLE[self.agent.dir])
|
||||||
|
self.update()
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user