Forum rules - please read before posting.

2d Stairs Movement


Hello We are making 2d game and there is scene with many stairs hopefully visible on picture.
So What I want to ask if there is some good way to animate stairs movement.
I was thinking about using triggers but at some stairs I do know if player will go up or down
and I also lose destination position due to action list.
I was also thinking that we make animations of movement up and right
(our game is mainly left to right) and such but I am not sure
if it will look good. So I am glad for any advice.

Comments

  • Without seeing things in motion, it's hard to say if this is an issue with your character's motion, or with their animation. Are you looking to switch their regular walking animation to "walk upstairs / downstairs" variants?

    For complete control, you may want to look into the use of Timeline to control the character's motion and animation fully, but I'd start with just using Triggers to change your character's walk animation and see how well that solves things. The idea being that rather than playing a specific animation, changing the walk animation will allow the character to play the correct directional animation based on which direction they're facing.

    Try with just one stairs to begin with. Place a Trigger over it, and make sure When running is set to Run In Background, and Reacts is set to During Cutscenes And Gameplay. These together should stop it from interrupting the Player's destination when it runs.

    In this Trigger's ActionList, use a Character: Animate Action with a Method of Set Standard to change the Player's regular walking animation to a stair-walking set. If you supply NE, SE, SW and NW directions, that should cover the 4 possibilities.

    To revert things back to normal when they exit the stairs, add another AC_Trigger component to the same Trigger object (this way, it can use the first Trigger's collider shape), have this return animations to normal, but set the Trigger type to On Exit.

  • Thanks Chris I will try to do that I do not have animation from our animator yet but I thought about this solution too. What I am afraid is that animation do not play correctly and character leg does not be on stair but somewhere in middle of it. I am currently researching how to make this correctly. For now I think that I try your solution and then make update if it works or not.

  • edited May 2021

    One more question. Is it possible to use more trigger interaction for example thought script or it has to be just enter or exit? also is possible change trigger collider for example to polygon collider?

    OK I tried it and it is possible to change collider and also use multiple trigger script :)

  • edited May 2021

    What I am afraid is that animation do not play correctly and character leg does not be on stair but somewhere in middle of it.

    Another approach would be to have smaller Triggers at the ends of the stairs, which cause the Player to use them automatically. That way, you could snap the Player to the bottom/top beforehand to make sure that they sync with the animation correctly.

    As you'd need for this to block gameplay, however, doing so would interrupt the Player is they're on their way moving to e.g. a Hotspot that was clicked on. You should be able to resume this through scripting, though - the Hotspot that a Player is moving towards can be gotten with:

    AC.KickStarter.playerInteraction.GetHotspotMovingTo ();
    

    Is it possible to use more trigger interaction for example thought script or it has to be just enter or exit?

    Triggers - and all ActionLists - can be run through script by calling its Interact function.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.