Scal SuperSaperTestowy #1
@ -18,6 +18,13 @@ class GameUi:
|
|||||||
coord = 'x' if self.agent.dir in (1, 3) else 'y'
|
coord = 'x' if self.agent.dir in (1, 3) else 'y'
|
||||||
shift = -1 if self.agent.dir in (2, 3) else 1
|
shift = -1 if self.agent.dir in (2, 3) else 1
|
||||||
# print(coord, shift)
|
# print(coord, shift)
|
||||||
|
test = int(getattr(self.agent, coord) + shift)
|
||||||
|
if coord == 'x':
|
||||||
|
if self.env.field[self.agent.y][test].number in (2, 3):
|
||||||
|
return
|
||||||
|
elif coord == 'y':
|
||||||
|
if self.env.field[test][self.agent.x].number in (2, 3):
|
||||||
|
return
|
||||||
for x in range(8):
|
for x in range(8):
|
||||||
setattr(
|
setattr(
|
||||||
self.agent,
|
self.agent,
|
||||||
@ -38,7 +45,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.agent.img = pg.image.load(SAPPER_IDLE[self.agent.dir])
|
||||||
self.update()
|
self.update()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user