aboutsummaryrefslogtreecommitdiffstats
path: root/src/gameplay.cpp
diff options
context:
space:
mode:
authorsalaaad2 <arthurdurant263@gmail.com>2022-01-14 11:59:55 +0100
committersalaaad2 <arthurdurant263@gmail.com>2022-01-14 11:59:55 +0100
commitb68a18a730bf50c92fd2c562ae2ecb5c54692364 (patch)
tree91451bd274eb851b92e422338e57f37d0ab7684a /src/gameplay.cpp
parentadd license, better next screen and begin savestate (diff)
downloadthreshold-b68a18a730bf50c92fd2c562ae2ecb5c54692364.tar.gz
threshold-b68a18a730bf50c92fd2c562ae2ecb5c54692364.tar.bz2
threshold-b68a18a730bf50c92fd2c562ae2ecb5c54692364.tar.xz
threshold-b68a18a730bf50c92fd2c562ae2ecb5c54692364.tar.zst
threshold-b68a18a730bf50c92fd2c562ae2ecb5c54692364.zip
boss has the correct textures
Diffstat (limited to '')
-rw-r--r--src/gameplay.cpp22
1 files changed, 13 insertions, 9 deletions
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;
}
}