game: add: goal statistic
This commit is contained in:
@ -25,7 +25,7 @@ class Player(Spectator):
|
||||
|
||||
self.position: Position = Position(0.5, 0)
|
||||
|
||||
self.nb_goal: int = 0
|
||||
self.score: list[int] = []
|
||||
|
||||
self.rail: Segment = rail
|
||||
|
||||
@ -112,13 +112,23 @@ class Player(Spectator):
|
||||
print("bozoman")
|
||||
self.game.leave(self)
|
||||
|
||||
def add_goal(self):
|
||||
|
||||
timestamp = self.game.model.add_goal(self.user_id)
|
||||
|
||||
self.score.append(timestamp)
|
||||
|
||||
print(self.score)
|
||||
|
||||
return timestamp
|
||||
|
||||
def to_dict(self) -> dict:
|
||||
|
||||
data = {
|
||||
"username": self.username,
|
||||
"user_id": self.user_id,
|
||||
"position": self.position.to_dict(),
|
||||
"nb_goal": self.nb_goal,
|
||||
"score": [*self.score],
|
||||
|
||||
"rail": self.rail.to_dict(),
|
||||
|
||||
|
Reference in New Issue
Block a user