player movements

This commit is contained in:
andrea
2025-08-01 19:25:36 +02:00
parent 47729ceeb9
commit f2c8acb80a

View File

@@ -178,6 +178,28 @@ class BrSimPlayer():
return False
self.inventory.append(item)
def _move(self, delta_x, delta_y):
# XXX maps limits:
# probably this isn't player's business
# game orchestror should manage it
# to avoid that the player can go out from the map
# or can reach unaccessible points
# also because the player doens't know the Map (entities/gamemap.py)
self.coord_x += x
self.coord_y += y
def move_right(self):
self._move(1, 0)
def move_left(self):
self._move(-1, 0)
def move_top(self):
self._move(0, 1)
def move_bottom(self):
self._move(0, -1)
def escape(self):
# TODO It can run away from the fighting
return