Skip to content

Commit

Permalink
make thrown bombs explode on impact with badguys and players
Browse files Browse the repository at this point in the history
  • Loading branch information
Narre committed Aug 17, 2023
1 parent 864ff52 commit f65224d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/badguy/bomb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,16 @@ Bomb::collision_solid(const CollisionHit& hit)
HitResponse
Bomb::collision_player(Player& , const CollisionHit& )
{
if (m_physic.get_velocity() != Vector(0.f, 0.f))
explode();
return ABORT_MOVE;
}

HitResponse
Bomb::collision_badguy(BadGuy& , const CollisionHit& )
{
if (m_physic.get_velocity() != Vector(0.f, 0.f))
explode();
return ABORT_MOVE;
}

Expand Down
10 changes: 10 additions & 0 deletions src/badguy/goldbomb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ HitResponse
GoldBomb::collision(GameObject& object, const CollisionHit& hit)
{
if (tstate == STATE_TICKING) {
if (m_physic.get_velocity() != Vector(0.f, 0.f))
kill_fall();
if ( dynamic_cast<Player*>(&object) ) {
return ABORT_MOVE;
}
Expand All @@ -79,7 +81,11 @@ HitResponse
GoldBomb::collision_player(Player& player, const CollisionHit& hit)
{
if (tstate == STATE_TICKING)
{
if (m_physic.get_velocity() != Vector(0.f, 0.f))
kill_fall();
return FORCE_MOVE;
}
if (is_grabbed())
return FORCE_MOVE;
return BadGuy::collision_player(player, hit);
Expand All @@ -89,7 +95,11 @@ HitResponse
GoldBomb::collision_badguy(BadGuy& badguy, const CollisionHit& hit)
{
if (tstate == STATE_TICKING)
{
if (m_physic.get_velocity() != Vector(0.f, 0.f))
kill_fall();
return FORCE_MOVE;
}
return WalkingBadguy::collision_badguy(badguy, hit);
}

Expand Down

0 comments on commit f65224d

Please sign in to comment.