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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions data/images/tiles.strf
Original file line number Diff line number Diff line change
Expand Up @@ -6304,12 +6304,12 @@
5230 5231 0 0 0 0 0 0 0
)
(attributes
257 257 257 257 257 17 17 17 17
257 257 257 257 257 17 17 17 17
257 257 257 257 257 17 17 17 17
257 257 257 257 257 17 17 17 17
257 257 0 257 257 0 0 17 17
257 257 257 257 257 0 0 17 17
257 257 257 257 257 273 273 273 273
257 257 257 257 257 273 273 273 273
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)

257 257 257 257 257 0 0 0 0
257 257 257 257 257 0 0 0 0
257 257 257 0 0 0 0 0 0
Expand Down Expand Up @@ -7146,10 +7146,10 @@
)
(attributes
0 0 0 0 0 0
1 1 0 1 17 17
1 1 0 1 0 0
0 0 0 0 17 17
17 17 17 17 17 17
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.

)
(datas
0 0 0 0 0 0
Expand Down Expand Up @@ -7281,11 +7281,11 @@
2070 2071 2072 2073 2074 5428 5429 5430 5431 5432 2079
)
(attributes
0 0 0 0 0 0 0 3 3 0 0
0 0 0 0 0 3 3 3 3 0 0
0 0 0 0 0 3 3 3 3 3 3
0 0 0 0 0 0 0 3 3 3 3
0 0 3 3 3 3 3 3 3 3 0
0 0 0 0 0 0 0 259 259 0 0
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

)
(images "tiles/snow/unisolid.png")
)
Expand Down Expand Up @@ -8632,10 +8632,10 @@
7447 7448 7449 7450
)
(attributes
1 1 1 1
1 1 1 1
1 1 1 0
1 1 0 0
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

0 0 0 0
0 0 0 0
0 0 0 0
Expand Down
13 changes: 9 additions & 4 deletions src/object/rock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Rock::collision_solid(const CollisionHit& hit)
if (is_grabbed()) {
return;
}
if (hit.top || hit.bottom)
if (!m_on_ice && (hit.top || hit.bottom))
m_physic.set_velocity_y(0);

if (hit.left || hit.right) {
Expand All @@ -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.

}

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

}
}

HitResponse
Expand Down Expand Up @@ -286,8 +290,9 @@ Rock::ungrab(MovingObject& object, Direction dir)
}
else
{
m_physic.set_velocity_x(fabsf(player->get_physic().get_velocity_x()) < 1.f ? 0.f :
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.

m_physic.set_velocity_y((dir == Direction::UP) ? -500.f : (dir == Direction::DOWN) ? 500.f :
(glm::length(m_last_movement) > 1) ? -200.f : 0.f);
}
Expand Down
Loading