0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 07:53:43 +00:00

added some comments for clarity

This commit is contained in:
Markus 2024-01-22 17:54:36 -06:00
parent 7c87ccc42b
commit 02cbc58d0b
2 changed files with 6 additions and 7 deletions

View File

@ -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

View File

@ -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();