add impassable terrain
This commit is contained in:
parent
edb56dac1d
commit
227a246968
@ -18,6 +18,13 @@ class GameUi:
|
||||
coord = 'x' if self.agent.dir in (1, 3) else 'y'
|
||||
shift = -1 if self.agent.dir in (2, 3) else 1
|
||||
# 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):
|
||||
setattr(
|
||||
self.agent,
|
||||
@ -38,7 +45,7 @@ class GameUi:
|
||||
|
||||
def rotate(self, dir):
|
||||
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