Rotating when jumping or falling

I have a character that moves horizontally, and can both jump and fall, I want him to rotate 90 degrees every time he jumps or falls. What's the best way to accomplish this ?.

Answers

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    Use the rotate behavior whenever the actor jumps.

  • LyboTechLyboTech Member Posts: 135

    @RThurman said:
    Use the rotate behavior whenever the actor jumps.

    Should've been more clear: I've already tried to "Rotate to angle" Self.rotation -> Self.rotation+90. But that doesn't work

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    You might want to provide a little more information about what you've done and what is not working.

  • The_Gamesalad_GuruThe_Gamesalad_Guru Member Posts: 9,922

    @LyboTech said:

    @RThurman said:
    Use the rotate behavior whenever the actor jumps.

    Should've been more clear: I've already tried to "Rotate to angle" Self.rotation -> Self.rotation+90. But that doesn't work

    That's not going to work as you are changing the real rotation against itself. You need to store the current rotation in a self variable.

    So

    Make a self variable self.rotateangle

    Rule

    Whatever condition you want to trigger the rotation

    Change attribute self.rotateangle to self.rotation

    Rotate to angle self.rotateangle+90

  • 8bitninja8bitninja Member Posts: 367

    I would do it with the Animate behavior.

  • LyboTechLyboTech Member Posts: 135

    @Lost_Oasis_Games Thanks, I've tried that but it doesn't work.
    @8bitninja It would work except I'm gonna have 20 different characters :neutral:

    I'll try to do a workaround I guess..

Sign In or Register to comment.