Add method returning stats field from Player

This commit is contained in:
Michał Czekański 2020-04-05 23:43:40 +02:00
parent df040b54f8
commit a60a46cc53

View File

@ -6,6 +6,8 @@ import pygame
class Player(Entity): class Player(Entity):
statistics: Statistics
def __init__(self, spawnpoint, size): def __init__(self, spawnpoint, size):
super().__init__("player.jpg", size, (spawnpoint[0] * size, spawnpoint[1] * size)) super().__init__("player.jpg", size, (spawnpoint[0] * size, spawnpoint[1] * size))
# Where the player is facing, 0 - north, 1 # Where the player is facing, 0 - north, 1
@ -36,6 +38,9 @@ class Player(Entity):
return self.statistics.stamina return self.statistics.stamina
return None return None
def getStatistics(self):
return self.statistics
def rotate(self, rotation): def rotate(self, rotation):
# If the player is not facing given direction, it will not move the first time, it will only get rotated # If the player is not facing given direction, it will not move the first time, it will only get rotated
if self.rotation.value != rotation.value: if self.rotation.value != rotation.value: