Move the camera with the player
This commit is contained in:
parent
d5ef041f48
commit
26196a7dca
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue