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();
|
createAllHearts();
|
||||||
}
|
}
|
||||||
|
|
||||||
void update() override {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void createAllHearts() {
|
void createAllHearts() {
|
||||||
int x;
|
|
||||||
|
int x; //starting position for first health icon
|
||||||
|
|
||||||
if(player) {
|
if(player) {
|
||||||
x = 10;
|
x = 10;
|
||||||
@ -35,6 +32,8 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
for(int i = 0; i < health; i++) {
|
for(int i = 0; i < health; i++) {
|
||||||
|
|
||||||
|
//checks for player side
|
||||||
if(player) {
|
if(player) {
|
||||||
createHeartComponents(x);
|
createHeartComponents(x);
|
||||||
x += 50;
|
x += 50;
|
||||||
@ -59,8 +58,6 @@ private:
|
|||||||
|
|
||||||
int health;
|
int health;
|
||||||
|
|
||||||
TransformComponent* transformComponent;
|
|
||||||
|
|
||||||
Manager* manager;
|
Manager* manager;
|
||||||
|
|
||||||
bool player; //true if player1 / false if player2
|
bool player; //true if player1 / false if player2
|
||||||
|
|||||||
@ -140,6 +140,7 @@ void Game::update()
|
|||||||
|
|
||||||
enemy.getComponent<HealthComponent>().getDamage();
|
enemy.getComponent<HealthComponent>().getDamage();
|
||||||
|
|
||||||
|
//display updated health | pretty scuffed but works ig
|
||||||
for(auto h : hearts)
|
for(auto h : hearts)
|
||||||
h->destroy();
|
h->destroy();
|
||||||
|
|
||||||
@ -161,6 +162,7 @@ void Game::update()
|
|||||||
|
|
||||||
player.getComponent<HealthComponent>().getDamage();
|
player.getComponent<HealthComponent>().getDamage();
|
||||||
|
|
||||||
|
//display updated health
|
||||||
for(auto h : hearts)
|
for(auto h : hearts)
|
||||||
h->destroy();
|
h->destroy();
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user