31 lines
718 B
Python
31 lines
718 B
Python
from ..interfaces import FightingEntity
|
|
|
|
|
|
class Player(FightingEntity):
|
|
maxhealth = 20
|
|
strength = 5
|
|
|
|
def move_up(self) -> bool:
|
|
return self.check_move(self.y - 1, self.x, True)
|
|
|
|
def move_down(self) -> bool:
|
|
return self.check_move(self.y + 1, self.x, True)
|
|
|
|
def move_left(self) -> bool:
|
|
return self.check_move(self.y, self.x - 1, True)
|
|
|
|
def move_right(self) -> bool:
|
|
return self.check_move(self.y, self.x + 1, True)
|
|
|
|
currentXP: int
|
|
maxXP: int
|
|
|
|
def level_up(self):
|
|
if currentXP>maxXP :
|
|
self.level+=1
|
|
currentXP = 0
|
|
maxXP = self.level*10
|
|
def addXP(self, xp) :
|
|
currentXP+=xp
|
|
self.level_up()
|