diff options
author | salaaad2 <arthurdurant263@gmail.com> | 2022-01-17 01:20:00 +0100 |
---|---|---|
committer | salaaad2 <arthurdurant263@gmail.com> | 2022-01-17 01:20:00 +0100 |
commit | 69de11fcf110d2ff17157cd9b384c4e8a701f869 (patch) | |
tree | 63e20c8ac906e07c1314810c480c2e65636df6ca /src/gameplay.cpp | |
parent | enemy slingshot is functional (diff) | |
download | threshold-69de11fcf110d2ff17157cd9b384c4e8a701f869.tar.gz threshold-69de11fcf110d2ff17157cd9b384c4e8a701f869.tar.bz2 threshold-69de11fcf110d2ff17157cd9b384c4e8a701f869.tar.xz threshold-69de11fcf110d2ff17157cd9b384c4e8a701f869.tar.zst threshold-69de11fcf110d2ff17157cd9b384c4e8a701f869.zip |
what ?
Diffstat (limited to 'src/gameplay.cpp')
-rw-r--r-- | src/gameplay.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/gameplay.cpp b/src/gameplay.cpp index bfa9190..543969a 100644 --- a/src/gameplay.cpp +++ b/src/gameplay.cpp @@ -215,12 +215,12 @@ int Game::tick() { en->posY += 2.1f; en->direction.y += 0.1f; } - if ((GetRandomValue(0, 100) == 50) && + if ((GetRandomValue(0, 100) == 50) && // make enemy fire at random intervals (en->currentWeapon != nullptr)) { - std::cout << "spawn enemy" << std::endl; en->currentWeapon->bang(enemies, &(*en)); nEnemies++; - return (0); + return (0); // NOTE: this return is here to make sure that we don't run into a segfault if + // adding an enemy to the vector reallocs and invalidates the iterator. } } else { if (en->posX >= SCREENWIDTH || en->posX <= 0 || |