Skip to content

Commit

Permalink
Improve haywire jumping
Browse files Browse the repository at this point in the history
Let haywire always attempt to jump over gaps, not only if Tux is above.

Fixes SuperTux#2716
  • Loading branch information
Brockengespenst committed Jan 17, 2024
1 parent 5d628c2 commit c7c4174
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/badguy/haywire.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,14 @@ Haywire::active_update(float dt_sec)
}
else
{
// Jump over gaps if Tux isn't below.
// Jump over gaps
Rectf gap_box = get_bbox();
gap_box.set_left(m_col.m_bbox.get_left() + (m_dir == Direction::LEFT ? -38.f : 26.f));
gap_box.set_right(m_col.m_bbox.get_right() + (m_dir == Direction::LEFT ? -26.f : 38.f));
gap_box.set_top(m_col.m_bbox.get_top());
gap_box.set_bottom(m_col.m_bbox.get_bottom() + 28.f);

if (Sector::get().is_free_of_statics(gap_box)
&& (player->get_bbox().get_bottom() <= m_col.m_bbox.get_bottom()))
if (Sector::get().is_free_of_statics(gap_box))
{
m_physic.set_velocity_y(-325.f);
m_jumping = true;
Expand Down

0 comments on commit c7c4174

Please sign in to comment.