diff --git a/dungeonbattle/entities/player.py b/dungeonbattle/entities/player.py index bef881c..2dce91e 100644 --- a/dungeonbattle/entities/player.py +++ b/dungeonbattle/entities/player.py @@ -13,6 +13,14 @@ class Player(FightingEntity): current_xp: int = 0 max_xp: int = 10 + def move(self, y: int, x: int) -> None: + """ + When the player moves, move the camera of the map. + """ + super().move(y, x) + self.map.currenty = y + self.map.currentx = x + def move_up(self) -> bool: return self.check_move(self.y - 1, self.x, True) diff --git a/dungeonbattle/game.py b/dungeonbattle/game.py index c393602..23cc598 100644 --- a/dungeonbattle/game.py +++ b/dungeonbattle/game.py @@ -50,8 +50,8 @@ class Game: self.map.currenty = 1 self.map.currentx = 6 self.player = Player() - self.player.move(1, 6) self.map.add_entity(self.player) + self.player.move(1, 6) self.map.spawn_random_entities(randint(1, 5)) @staticmethod