SUPER Space invader : Turbo edition DX - VS GOD 1.0.0
A simple space invader ripoff
player.h
Go to the documentation of this file.
1
12#ifndef GUARD_PLAYER_H
13#define GUARD_PLAYER_H
14
19struct Player{
20
24 unsigned lives = 3;
25
29 unsigned x;
30
34 unsigned id;
35
39 unsigned score=0;
40
45 unsigned deathAnimCounter=0;
46
50 unsigned fireCooldown=0;
51
52
58 bool hasDeathAnimation() const;
59
65 bool isEliminated() const;
66
72 bool isPlaying() const;
73
78 void damage();
79};
80
81#endif
player data structure
Definition: player.h:19
bool isPlaying() const
Tells if the player is playing, or has a death animation/is eliminated.
Definition: player.cpp:14
unsigned id
player's unique identidier
Definition: player.h:34
unsigned score
player's personal score
Definition: player.h:39
void damage()
Damage the player (no precondition on existing state)
Definition: player.cpp:26
unsigned deathAnimCounter
counter used for the death animation of players undefined once the player is eliminated
Definition: player.h:45
bool hasDeathAnimation() const
Tells if the player has a death animation ongoing.
Definition: player.cpp:18
unsigned fireCooldown
player's shooting cooldown
Definition: player.h:50
bool isEliminated() const
Tells if the player is eliminated (no more lives)
Definition: player.cpp:22
unsigned x
x coordinate of the player
Definition: player.h:29
unsigned lives
player life points
Definition: player.h:24