From 02cbc58d0b527b707979cb526f068ff5af1dd34a Mon Sep 17 00:00:00 2001 From: Markus Date: Mon, 22 Jan 2024 17:54:36 -0600 Subject: [PATCH] added some comments for clarity --- include/HealthComponent.h | 11 ++++------- src/Game.cpp | 2 ++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/include/HealthComponent.h b/include/HealthComponent.h index ed18c5f..7f34040 100644 --- a/include/HealthComponent.h +++ b/include/HealthComponent.h @@ -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 diff --git a/src/Game.cpp b/src/Game.cpp index c7ad6ac..5a92228 100644 --- a/src/Game.cpp +++ b/src/Game.cpp @@ -140,6 +140,7 @@ void Game::update() enemy.getComponent().getDamage(); + //display updated health | pretty scuffed but works ig for(auto h : hearts) h->destroy(); @@ -161,6 +162,7 @@ void Game::update() player.getComponent().getDamage(); + //display updated health for(auto h : hearts) h->destroy();