mirror of
https://github.com/Nimac0/SDL_Minigame
synced 2026-01-12 13:43:41 +00:00
added some comments for clarity
This commit is contained in:
parent
7c87ccc42b
commit
02cbc58d0b
@ -21,12 +21,9 @@ public:
|
||||
createAllHearts();
|
||||
}
|
||||
|
||||
void update() override {
|
||||
|
||||
}
|
||||
|
||||
void createAllHearts() {
|
||||
int x;
|
||||
|
||||
int x; //starting position for first health icon
|
||||
|
||||
if(player) {
|
||||
x = 10;
|
||||
@ -35,6 +32,8 @@ public:
|
||||
}
|
||||
|
||||
for(int i = 0; i < health; i++) {
|
||||
|
||||
//checks for player side
|
||||
if(player) {
|
||||
createHeartComponents(x);
|
||||
x += 50;
|
||||
@ -59,8 +58,6 @@ private:
|
||||
|
||||
int health;
|
||||
|
||||
TransformComponent* transformComponent;
|
||||
|
||||
Manager* manager;
|
||||
|
||||
bool player; //true if player1 / false if player2
|
||||
|
||||
@ -140,6 +140,7 @@ void Game::update()
|
||||
|
||||
enemy.getComponent<HealthComponent>().getDamage();
|
||||
|
||||
//display updated health | pretty scuffed but works ig
|
||||
for(auto h : hearts)
|
||||
h->destroy();
|
||||
|
||||
@ -161,6 +162,7 @@ void Game::update()
|
||||
|
||||
player.getComponent<HealthComponent>().getDamage();
|
||||
|
||||
//display updated health
|
||||
for(auto h : hearts)
|
||||
h->destroy();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user