From b68a18a730bf50c92fd2c562ae2ecb5c54692364 Mon Sep 17 00:00:00 2001
From: salaaad2 <arthurdurant263@gmail.com>
Date: Fri, 14 Jan 2022 11:59:55 +0100
Subject: boss has the correct textures

---
 src/gameplay.cpp | 22 +++++++++++++---------
 src/gameplay.hpp |  7 ++++---
 2 files changed, 17 insertions(+), 12 deletions(-)

(limited to 'src')

diff --git a/src/gameplay.cpp b/src/gameplay.cpp
index ba1c07a..983afa0 100644
--- a/src/gameplay.cpp
+++ b/src/gameplay.cpp
@@ -74,8 +74,8 @@ Game::Game(std::string const& path) : current(path) {
     );
 
     for (auto i = 0; i < nPerWave; i++) {
-        if (ehp == 0) {
-            Entity en(1);
+        if (ehp == 1) {
+            Entity en(ehp);
             en.radius = radius;
             en.idleTex = LoadTexture(SBIRE_TEX_IDLE);
             en.hurtTex = LoadTexture(SBIRE_TEX_HURT);
@@ -86,8 +86,8 @@ Game::Game(std::string const& path) : current(path) {
             en.radius = radius;
             en.wp[0] = shotty;
             en.currentWeapon = en.wp[0];
-            en.idleTex = LoadTexture(SBIRE_TEX_IDLE);
-            en.hurtTex = LoadTexture(SBIRE_TEX_HURT);
+            en.idleTex = LoadTexture(BOSS_TEX_IDLE);
+            en.hurtTex = LoadTexture(BOSS_TEX_HURT);
             enemies->push_back(en);  // legacy code. TODO: remove AKchually no
         }
     }
@@ -133,10 +133,10 @@ void Game::draw() {
 
     for (auto& en : *enemies) {
         if (en.hp == 0)
-            DrawTextureEx(en.hurtTex, (Vector2){en.posX - 20, en.posY - 20},
+            DrawTextureEx(en.hurtTex, (Vector2){en.posX - en.radius, en.posY - en.radius},
                           1.0f, 0.6f, WHITE);
         else {
-            DrawTextureEx(en.idleTex, (Vector2){en.posX - 20, en.posY - 20},
+            DrawTextureEx(en.idleTex, (Vector2){en.posX - en.radius, en.posY - en.radius},
                           1.0f, 0.6f, WHITE);
         }
     }
@@ -158,6 +158,13 @@ void Game::draw() {
     for (auto i = 0; i < player->currentWeapon->barrel; i++) {
         DrawRectangle(40 + (i * 20), SCREENHEIGHT - 60, 10, 30, RED);
     }
+    if (enemies->at(0).hp >= 2) {
+        for (auto i = 0; i < enemies->size(); i++) {
+            for (auto j = 0; j < enemies->at(i).hp; j++) {
+                DrawRectangle(400 + (j * 40), 80 + (i * 40), 40, 30, COOLPURPLE);
+            }
+        }
+    }
 }
 
 // progress the game & check for player death
@@ -176,15 +183,12 @@ int Game::tick() {
 
     if (player->victims == nPerWave && nWaves > 1) {
         nWaves--;
-        std::cout << "DEBUG : waves left [" << nWaves << std::endl;
-        std::cout << "DEBUG : victims [" << nWaves << std::endl;
         for (int i = 0 ; i < nPerWave; i++) {
             Entity en(1);
             en.radius = 20;
             en.idleTex = LoadTexture(SBIRE_TEX_IDLE);
             en.hurtTex = LoadTexture(SBIRE_TEX_HURT);
             enemies->push_back(en);
-            std::cout << "DEBUG : spawn new enemy [" << i << std::endl;
         }
     }
 
diff --git a/src/gameplay.hpp b/src/gameplay.hpp
index 4f16504..5d02e4c 100644
--- a/src/gameplay.hpp
+++ b/src/gameplay.hpp
@@ -34,9 +34,10 @@
 #define SBIRE_TEX_IDLE "../meta/media/sprites/sbire_idle.png"
 #define SBIRE_TEX_HURT "../meta/media/sprites/sbire_hurt.png"
 
-#define BACKGROUND_TEX "../meta/media/sprites/background.png"
-
-// TODO: boss textures
+// boss textures
+#define BOSS_TEX_IDLE "../meta/media/sprites/boss_idle.png"
+#define BOSS_TEX_HURT "../meta/media/sprites/boss_hurt.png"
+#define BOSS_TEX_DEAD "../meta/media/sprites/boss_hurt.png"
 
 // #define COOLPURPLE \
 //     CLITERAL(Color) { 170, 153, 255, 255 }  // cool Purple
-- 
cgit v1.2.3