life interaction? i guess
This commit is contained in:
parent
6faffb7baf
commit
4737d9dcb3
@ -2,7 +2,7 @@
|
|||||||
#define GUARD_PLAYER_H
|
#define GUARD_PLAYER_H
|
||||||
|
|
||||||
struct Player{
|
struct Player{
|
||||||
unsigned lives;
|
unsigned lives = 3;
|
||||||
unsigned x;
|
unsigned x;
|
||||||
unsigned id;
|
unsigned id;
|
||||||
unsigned score=0;
|
unsigned score=0;
|
||||||
|
@ -35,9 +35,8 @@ void Game::displayAll(unsigned fps) const {
|
|||||||
|
|
||||||
// As said before, the player loop is an illusion, 2 players max
|
// As said before, the player loop is an illusion, 2 players max
|
||||||
for(unsigned i=0;i<players[0].lives;++i){
|
for(unsigned i=0;i<players[0].lives;++i){
|
||||||
|
pm.drawHeart(Position(i * 70, 70));
|
||||||
}
|
}
|
||||||
pm.drawHeart(Position(0, 70));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Game::displayHearts(playerID pID) const {
|
void Game::displayHearts(playerID pID) const {
|
||||||
|
@ -141,6 +141,7 @@ bool Game::checkMissilesAndPlayers() {
|
|||||||
miss_ite->getX(), miss_ite->getX() + confData.missilesWidth,
|
miss_ite->getX(), miss_ite->getX() + confData.missilesWidth,
|
||||||
p.x, p.x + confData.playersWidth)){
|
p.x, p.x + confData.playersWidth)){
|
||||||
wasColliding = true;
|
wasColliding = true;
|
||||||
|
--p.lives;
|
||||||
if(p.deathAnimCounter)p.deathAnimCounter = 1;
|
if(p.deathAnimCounter)p.deathAnimCounter = 1;
|
||||||
// do not break, the second player also deserves to be hit
|
// do not break, the second player also deserves to be hit
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user