From f2c8acb80a601cd57af9fcb3444bfbe3c52619f9fce66ee32f9a4d48a5bdbe05 Mon Sep 17 00:00:00 2001 From: andrea Date: Fri, 1 Aug 2025 19:25:36 +0200 Subject: [PATCH] player movements --- entities/player.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/entities/player.py b/entities/player.py index 9bdfbf5..ee8e523 100644 --- a/entities/player.py +++ b/entities/player.py @@ -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