Skip to content

Fixes #3215: Ice isn't slippery for rocks #3226

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

goncalof148
Copy link

@goncalof148 goncalof148 commented Mar 27, 2025

Since the ice floor wasn't being recognized as ice, specially on the hills on level "Tip of the Ice", the floor didn't have the slippery feature. I changed the tile attributes to address this problem and added a condition on the rock logic to include a slippery property on ice. Now tux can throw a rock to hills and it will slide back down due to the slippery property.

Video: https://youtube.com/shorts/B_z0Fx5yYJc?feature=share

Closes #3215

Since the ice floor wasn't being recognized as ice, specially on the
hills on level "Tip of the Ice", the floor didn't have the slippery
feature. I changed the tile attributes to address this problem and
added a condition on the rock logic to include a slippery property
on ice. Now tux can throw a rock to hills and it will slide back
down due to the slippery property.
@goncalof148 goncalof148 changed the title Fix #3215: Ice isn't slippery for rocks Fixes #3215: Ice isn't slippery for rocks Mar 28, 2025
@goncalof148
Copy link
Author

@tobbi could you check this, please?

257 257 257 257 257 273 273 273 273
257 257 257 257 257 273 273 273 273
257 257 0 257 257 0 0 273 273
257 257 257 257 257 0 0 273 273
Copy link
Member

@Hypernoot Hypernoot Apr 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rusty-Box The ice slopes aren't slippery. Was that intended? (tiles/snow/icechunk.png)

@Hypernoot
Copy link
Member

Hypernoot commented Apr 7, 2025

It looks like the behaviour is almost the same, both in master and this PR. So what was actually fixed?

  1. non-ice solid flat tiles - In both versions, the rock stops instantly. That is correct.
  2. solid flat ice - In both versions, the rock slides for approx. 1s and then it stops. Wasn't that supposed to be different?
  3. solid ice slope - In master, the rock stops instantly, unless it is given an initial speed. In this PR, the rock slowly slides down and jitters occasionally.
  4. unisolid flat ice - In both versions, the rock just stops.
  5. unisolid ice slope - In both versions, the rock just stops.
  6. non-ice solid tiles with unisolid flat ice overlay - same as case 3
  7. non-ice solid tiles with unisolid ice slope overlay - same as case 4

@goncalof148
Copy link
Author

goncalof148 commented Apr 10, 2025

@Hypernoot @Rusty-Box @tobbi could you check this last version?

Solid Flat Ice: I decreased the friction
Solid Ice Slope: Now there is a minimum force to throw the rock
Unisolid flat ice and slope: I updated that part

Copy link
Member

@Hypernoot Hypernoot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't test it in-game but I suspect that anything essential has changed, except that the ice friction was decreased. So that fixes point 1. The rest remains.

If this PR shall be treated as a partial fix, then all you need is decreasing one value, the ice friction. And you can drop all the other changes.

257 257 0 257 273 273
257 257 0 257 0 0
0 0 0 0 273 273
273 273 273 273 273 273
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These tiles were not supposed to be slippery. If you need some testing tiles, then make the changes locally and don't push them to the PR.

0 0 0 0 0 259 259 259 259 0 0
0 0 0 0 0 259 259 259 259 259 259
0 0 0 0 0 0 0 259 259 259 259
0 0 259 259 259 259 259 259 259 259 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

257 257 257 257
257 257 257 257
257 257 257 0
257 257 0 0
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

@@ -177,10 +177,14 @@ Rock::collision_solid(const CollisionHit& hit)
m_at_ceiling = true;
}

if (m_on_ground || (hit.bottom && m_on_ice)) {
if (m_on_ground && !m_on_ice) {
// Full friction!
m_physic.set_velocity_x(m_physic.get_velocity_x() * (1.f - (GROUND_FRICTION * (m_on_ice ? 0.5f : 1.f))));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to check for the same condition twice.

// Full friction!
m_physic.set_velocity_x(m_physic.get_velocity_x() * (1.f - (GROUND_FRICTION * (m_on_ice ? 0.5f : 1.f))));
}

if (hit.bottom && m_on_ice) {
m_physic.set_velocity_x(m_physic.get_velocity_x() * (1.f - (GROUND_FRICTION * (m_on_ice ? 0.2f : 1.f))));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

player->m_dir == Direction::LEFT ? -200.f : 200.f);
//add minimum force when tux is still
float throw_force = std::max(fabsf(player->get_physic().get_velocity_x()), 50.f);
m_physic.set_velocity_x(player->m_dir == Direction::LEFT ? -throw_force : throw_force);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does the throwing speed need to be changed? Nobody complained about this.

@goncalof148
Copy link
Author

@Hypernoot I thought I fixed the problems! Could you help me identify the right tiles? On the code I can't identify them by their type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Ice isn't really slippery for rocks
2 participants