diff options
-rw-r--r-- | src/gameplay.cpp | 5 | ||||
-rw-r--r-- | src/weapon.hpp | 2 | ||||
-rw-r--r-- | src/wp_assaultrifle.cpp | 4 | ||||
-rw-r--r-- | src/wp_shotty.cpp | 6 |
4 files changed, 7 insertions, 10 deletions
diff --git a/src/gameplay.cpp b/src/gameplay.cpp index 543969a..3dfdd5e 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -124,7 +124,7 @@ void Game::draw() { auto left = std::to_string(enemies->size()); for (auto& en : *enemies) { - if (en.hp == 0) + if (en.hp <= 0) DrawTextureEx(en.hurtTex, (Vector2){en.posX - en.radius, en.posY - en.radius}, 1.0f, 0.6f, WHITE); @@ -174,9 +174,6 @@ int Game::tick() { auto v2 = (Vector2){target.x - player->posX, target.y - player->posY}; - DrawText(std::to_string(v2.x).c_str(), 1400, 10, 20, RED); - DrawText(std::to_string(v2.y).c_str(), 1400, 30, 20, RED); - player->direction = v2; if (player->victims == nPerWave && nWaves > 1) { diff --git a/src/weapon.hpp b/src/weapon.hpp index d75d826..d7f8df3 100644 --- a/src/weapon.hpp +++ b/src/weapon.hpp @@ -27,7 +27,7 @@ class AWeapon { double t; float const range; - unsigned int const& damage; + unsigned int const damage; const std::string name; public: diff --git a/src/wp_assaultrifle.cpp b/src/wp_assaultrifle.cpp index 41a3c91..0be3d5b 100644 --- a/src/wp_assaultrifle.cpp +++ b/src/wp_assaultrifle.cpp @@ -7,7 +7,7 @@ #include "entity.hpp" wp_assaultrifle::wp_assaultrifle(const char* s, const char* r) - : AWeapon(300.0f, 10, 30, 0.0, s, r, "ar") {} + : AWeapon(300.0f, 1, 30, 0.0, s, r, "ar") {} int wp_assaultrifle::bang(std::vector<Entity>* enemies, Entity* player) { if (barrel == 0) { @@ -43,7 +43,7 @@ int wp_assaultrifle::bang(std::vector<Entity>* enemies, Entity* player) { playerPosition, add2, (en->radius * 2))) { // enemy hit std::cout << "hit" << std::endl; - en->hp--; + en->hp -= damage; if (en->hp == 0) { en->direction.x = (playerDirection.x / 2); en->direction.y = (playerDirection.y / 2); diff --git a/src/wp_shotty.cpp b/src/wp_shotty.cpp index f2a5d22..7d61ab3 100644 --- a/src/wp_shotty.cpp +++ b/src/wp_shotty.cpp @@ -7,7 +7,7 @@ #include "entity.hpp" wp_shotty::wp_shotty(const char* s, const char* r) - : AWeapon(100.0f, 10, 10, 0.5, s, r, "shotty") {} + : AWeapon(100.0f, 3, 10, 0.5, s, r, "shotty") {} int wp_shotty::bang(std::vector<Entity>* enemies, Entity* player) { if (barrel == 0 || GetTime() < (t + cooldown)) { @@ -44,8 +44,8 @@ int wp_shotty::bang(std::vector<Entity>* enemies, Entity* player) { playerPosition, add2, (en->radius * 2))) { // enemy hit std::cout << "hit" << std::endl; - en->hp--; - if (en->hp == 0) { + en->hp -= damage; + if (en->hp <= 0) { en->direction.x = (playerDirection.x / 2); en->direction.y = (playerDirection.y / 2); player->victims += 1; |