Skip to content
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

Tux sliding on belly sprite should be orientated to fit the angle of the slope they're sliding down #2723

Closed
RustoMCSpit opened this issue Jan 1, 2024 · 9 comments · Fixed by #2795

Comments

@RustoMCSpit
Copy link

13 seconds into the SuperTux: Development Summary of 2023! we see Tux stay perfectly horizontal on a slope while sliding rather than diagonally.

@RustoMCSpit
Copy link
Author

Dependent on (#1448)

@bruhmoent
Copy link
Member

Dependent on (#1448)

The sprite isn't dependent on the hitbox.

@RustoMCSpit
Copy link
Author

RustoMCSpit commented Jan 1, 2024

This would also requires smooth transitioning / blending between orientations which are impacted by velocity / acceleration. This could be done via interpolation, easing, dynamic effect (blender animation suite terminology) and by plugging in the variables.

@Brockengespenst
Copy link
Contributor

If it is just about simply rotating the sprite, this can be achieved by placing

if (m_sliding)
{
  float sprite_angle = 0.0f;
  if (m_floor_normal.y != 0.0f)
  {
   sprite_angle = math::degrees(math::angle(m_floor_normal)) + 90.0f;
 }
 m_sprite->set_angle(sprite_angle);
}

Around line 1436 in player.cpp (probably also other places possible). The result would be the following:

Supertux-Sliding-Angle.mp4

This would not rotate the hitbox, just the sprite of Tux.
It also does not include a "smooth transition" right now, which is most likely a bit more complex to implement.

If the above behavior would be Ok as a first step, I could create a PR if you like.

@tobbi
Copy link
Member

tobbi commented Feb 3, 2024

Fuck yeah, this is already more awesome than what we have in the game.

@Brockengespenst
Copy link
Contributor

Brockengespenst commented Feb 3, 2024

I created a PR that, additionally to the above mentioned changes, also uses Tux' velocity for sprite orientation in case you jump off an edge while sliding.

@Frostwithasideofsalt
Copy link
Member

THIS IS PEAK

mrkubax10 pushed a commit that referenced this issue Feb 3, 2024
Use the underground's normal to calculate the sprite orientation of Tux while sliding on ground.
If still sliding while in air (e.g. due to jumping off a cliff while sliding), rotate the sprite according to velocity.

Addresses, but may not fully implement #2723
@RustoMCSpit
Copy link
Author

RustoMCSpit commented Feb 4, 2024

Supertux-Sliding-Angle.mp4

hold om this gives me a genius idea. we can have level design based on this new mechanic where tux has to slide to generate momentum and then fly off an edge to get over a gap like in https://apps.apple.com/gb/app/racing-penguin-slide-and-fly/id443637419

@RustoMCSpit
Copy link
Author

RustoMCSpit commented Feb 4, 2024

there should also be particle effects depending on the environment!

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 a pull request may close this issue.

5 participants