Skip to content

Commit

Permalink
Fix buttjump hitbox to not include actual player (#2562)
Browse files Browse the repository at this point in the history
This prevents being able to buttjump to kill enemies while they're being grabbed
  • Loading branch information
MatusGuy authored Jul 31, 2023
1 parent c31af16 commit 28c4786
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/object/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -748,14 +748,15 @@ Player::update(float dt_sec)
if (m_does_buttjump || (m_stone && m_physic.get_velocity_y() > 30.f && !m_coyote_timer.started()))
{
Rectf downbox = get_bbox().grown(-1.f);
downbox.set_bottom(get_bbox().get_bottom() + 16.f);
downbox.set_top(get_bbox().get_bottom());
downbox.set_bottom(downbox.get_bottom() + 16.f);
for (auto& brick : Sector::get().get_objects_by_type<Brick>()) {
// stoneform breaks through any kind of bricks
if (downbox.contains(brick.get_bbox()) && (m_stone || !dynamic_cast<HeavyBrick*>(&brick)))
brick.try_break(this, is_big());
}
for (auto& badguy : Sector::get().get_objects_by_type<BadGuy>()) {
if (downbox.contains(badguy.get_bbox()) && badguy.is_snipable())
if (downbox.contains(badguy.get_bbox()) && badguy.is_snipable() && !badguy.is_grabbed())
badguy.kill_fall();
}
}
Expand Down

0 comments on commit 28c4786

Please sign in to comment.