Skip to content

Commit

Permalink
They kill enemies now
Browse files Browse the repository at this point in the history
  • Loading branch information
weluvgoatz committed Jun 13, 2024
1 parent 84d923c commit 9f561e9
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/object/bigsnowball.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include "object/bigsnowball.hpp"

#include "badguy/badguy.hpp"
#include "badguy/yeti.hpp"
#include "math/random.hpp"
#include "math/util.hpp"
Expand Down Expand Up @@ -126,6 +127,13 @@ BigSnowball::collision(GameObject& other, const CollisionHit& hit)
return ABORT_MOVE;
}

auto badguy = dynamic_cast<BadGuy*>(&other); // cppcheck-suppress constVariablePointer
if (badguy && ((m_dir == Direction::LEFT && hit.left) || (m_dir == Direction::RIGHT && hit.right) || hit.bottom))
{
badguy->kill_fall();
return ABORT_MOVE;
}

auto player = dynamic_cast<Player*>(&other); // cppcheck-suppress constVariablePointer
if (player && player->m_does_buttjump && hit.top)
{
Expand Down

0 comments on commit 9f561e9

Please sign in to comment.