-
-
Notifications
You must be signed in to change notification settings - Fork 520
Fix #2509 : Floating Platform Object Idea #3278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The Floating Platform has the following characteristics: - Floats on top of water - Has a wave-like motion on water - Reacts to Tux jumping on it with bubbles and a sound effect - If not placed on water, behaves like a normal object with normal gravity - Is placed slightly under water to simulate floating - If it has rocks on top, it sinks faster or slower based on the number of rocks - If it's sinking and the rocks are removed, it floats again This object was created from scratch. We designed the sprite, implemented the FloatingPlatform class, and added it to the Level Editor so players can place it in custom levels. Co-authored-by: Tomás Correia <tomas.araujo.correia@tecnico.ulisboa.pt>
Can you please fix these compiler errors:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contributing!
A few notes:
- I'd recommend using the already existing icefloat (ice floes) sprites instead of introducing a new one,
- When changing the sprite of the
FloatingPlatform
, note that splashes aren't created across the full width, - When a rock is released from the platform, the platform doesn't go back up,
- The current behaviour is quite jittery and glitchy, especially in interactions with badguys and the player.
src/object/floating_platform.cpp
Outdated
Vector movement; | ||
if (!m_floating){ | ||
movement = m_physic.get_movement(dt_sec) * | ||
Vector(1.f, 1.f); | ||
} else{ | ||
movement = m_physic.get_movement(dt_sec) * | ||
Vector(1.f, in_water ? -0.05f : 0.01f); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Vector movement; | |
if (!m_floating){ | |
movement = m_physic.get_movement(dt_sec) * | |
Vector(1.f, 1.f); | |
} else{ | |
movement = m_physic.get_movement(dt_sec) * | |
Vector(1.f, in_water ? -0.05f : 0.01f); | |
} | |
Vector base_movement = m_physic.get_movement(dt_sec); | |
Vector movement = m_floating ? base_movement * Vector(1.f, in_water ? -0.05f : 0.01f) : base_movement; |
src/object/floating_platform.cpp
Outdated
for (int i = 0; i<10; i++){ | ||
Sector::get().add<RainSplash>(Vector(static_cast<float>(get_x()- 5.f + (i*8.f)), static_cast<float>(get_y()+11.f)), | ||
true); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
for (int i = 0; i<10; i++){ | |
Sector::get().add<RainSplash>(Vector(static_cast<float>(get_x()- 5.f + (i*8.f)), static_cast<float>(get_y()+11.f)), | |
true); | |
} | |
for (int i = 0; i < 10; i++) { | |
Sector::get().add<RainSplash>(Vector(get_x() - 5.f + (static_cast<float>(i) * 8.f), get_y() + 11.f), | |
true); | |
} |
src/object/floating_platform.cpp
Outdated
} | ||
m_player_offset = std::min(m_player_offset + sink_speed_player, max_sink_depth_player); | ||
m_physic.set_velocity_y(sink_speed_player); | ||
} else if (!player_check_zone.overlaps(other.get_bbox())){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} else if (!player_check_zone.overlaps(other.get_bbox())){ | |
} else if (!player_check_zone.overlaps(other.get_bbox())) { |
@bruhmoent about the notes, here is a video of what is happening https://www.youtube.com/watch?v=0HYPXKxie-Y |
2025-06-21.17-16-18.mp4 |
The Floating Platform has the following characteristics:
a sound effect
normal gravity
the number of rocks
Closes #2509