Coder Social home page Coder Social logo

Comments (9)

Brockengespenst avatar Brockengespenst commented on May 25, 2024 14

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.

from supertux.

RustoMCSpit avatar RustoMCSpit commented on May 25, 2024

Dependent on (#1448)

from supertux.

bruhmoent avatar bruhmoent commented on May 25, 2024

Dependent on (#1448)

The sprite isn't dependent on the hitbox.

from supertux.

RustoMCSpit avatar RustoMCSpit commented on May 25, 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.

from supertux.

tobbi avatar tobbi commented on May 25, 2024

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

from supertux.

Brockengespenst avatar Brockengespenst commented on May 25, 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.

from supertux.

Frostwithasideofsalt avatar Frostwithasideofsalt commented on May 25, 2024

THIS IS PEAK

from supertux.

RustoMCSpit avatar RustoMCSpit commented on May 25, 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

from supertux.

RustoMCSpit avatar RustoMCSpit commented on May 25, 2024

there should also be particle effects depending on the environment!

from supertux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.