diff options
author | salaaad2 <arthurdurant263@gmail.com> | 2022-01-14 16:40:11 +0100 |
---|---|---|
committer | salaaad2 <arthurdurant263@gmail.com> | 2022-01-14 16:40:11 +0100 |
commit | 7a0ec30b5444b9f07ddeaa6943edaf5bd02e0349 (patch) | |
tree | a85c1a47e1f41c6c6530f3fe3cb6ce66a2ea61c7 /src/gameplay.cpp | |
parent | strange behavior... I WILL find out whats going on ! (diff) | |
download | threshold-7a0ec30b5444b9f07ddeaa6943edaf5bd02e0349.tar.gz threshold-7a0ec30b5444b9f07ddeaa6943edaf5bd02e0349.tar.bz2 threshold-7a0ec30b5444b9f07ddeaa6943edaf5bd02e0349.tar.xz threshold-7a0ec30b5444b9f07ddeaa6943edaf5bd02e0349.tar.zst threshold-7a0ec30b5444b9f07ddeaa6943edaf5bd02e0349.zip |
enemy slingshot is functional
Diffstat (limited to 'src/gameplay.cpp')
-rw-r--r-- | src/gameplay.cpp | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/src/gameplay.cpp b/src/gameplay.cpp index 44987c9..bfa9190 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -64,9 +64,7 @@ Game::Game(std::string const& path) : current(path) { InitAudioDevice(); AWeapon* shotty = new wp_shotty(SHOTTY_BANG, SHOTTY_RELOAD); - AWeapon* ar = new wp_assaultrifle(AR_BANG, - SHOTTY_RELOAD - ); + AWeapon* ar = new wp_assaultrifle(AR_BANG, SHOTTY_RELOAD); AWeapon* sling = new wp_enemysling(SHOTTY_BANG, SHOTTY_RELOAD); for (auto i = 0; i < nPerWave; i++) { @@ -151,14 +149,17 @@ void Game::draw() { if (player->fury >= 5) { DrawText("[E] FURY", SCREENWIDTH - 300, 10, 50, RED); } - for (auto i = 0; i < player->currentWeapon->barrel; i++) { // draw weapon ammo + for (auto i = 0; i < player->currentWeapon->barrel; + i++) { // draw weapon ammo DrawRectangle(40 + (i * 20), SCREENHEIGHT - 60, 10, 30, RED); } - if (enemies->at(0).hp >= 2) { // draw hp in boss stages + if (enemies->at(0).hp >= 2) { // draw hp in boss stages 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); + if (enemies->at(i).hp >= 2) { + for (auto j = 0; j < enemies->at(i).hp; j++) { + DrawRectangle(400 + (j * 40), 80 + (i * 40), 40, 30, + COOLPURPLE); + } } } } @@ -214,10 +215,12 @@ int Game::tick() { en->posY += 2.1f; en->direction.y += 0.1f; } - if ((GetRandomValue(0, 100) == 50) && (en->currentWeapon != - nullptr)) { + if ((GetRandomValue(0, 100) == 50) && + (en->currentWeapon != nullptr)) { std::cout << "spawn enemy" << std::endl; en->currentWeapon->bang(enemies, &(*en)); + nEnemies++; + return (0); } } else { if (en->posX >= SCREENWIDTH || en->posX <= 0 || |