Move the camera with the player

This commit is contained in:
Yohann D'ANELLO 2020-11-10 22:02:41 +01:00
parent d5ef041f48
commit 26196a7dca
2 changed files with 9 additions and 1 deletions

View File

@ -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)

View File

@ -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