Forum rules - please read before posting.

Climb ladder up & down

edited June 2020 in Technical Q&A

Hi,

On a 2d game i have setup a vertical path with 2 nodes so the player can climb a ladder. The node 0 is at the bottom and the node 1 is at the top.
As it is now the player starts climbing up fine when i press the Up arrow but while in the middle of the ladder if i press the Down arrow (to go down) he keeps going up until he gets out of node 1.

Two questions:
A.
I would like please to be able to move up or down while he is still on the ladder at any time, so he can change direction when he wants while still on the ladder. Basically the usual mechanic of a ladder that we see in games.
I tried changing the Path Type to Random, Ping Pong, Loop etc but they don't seem to make any difference.

B.
Lets say he climbs up all the way and gets out of the path. If i want him to be able to go back down the ladder, do i have to use a second path with the nodes reversed so i can switch them on and off depending if he is above the ladder or below?

i use unity 2019.3.15f1 and AC v1.71.4 and Direct move.

Thank you

Comments

  • When using Direct movement, you can use the Player: Constrain Action to constrain the player's gameplay movement to just along that Path.

    When this occurs, the Player is snapped to the Path's origin - i.e. the first node - so you'll have to create two Paths for the up and down behaviours. I'd recommend getting things working with just one direction first, though.

    When locked to a Path during gameplay, the Path Type is ignored because the Player is still under direct-control. To exit the Path, you'll need to place down Triggers at either end to run a Character: Move along path Action with the Method set to Stop Moving.

  • edited June 2020

    Hello Chris,

    Can't make it work, I tried a lot of things.

    To make things easier for both I'm using your 2D Demo scene and I'm trying to make Brain climb up a ladder.
    I only changed the Movement method from "Point & Click" to "Direct" that's the only difference.

    I placed a ladder with a vertical path, a marker, a hotspot and an exit trigger.

    The Scene:
    https://imgur.com/lp4DSJu

    The ladder path:
    https://imgur.com/iFHIr2n

    The Ladder hotspot:
    https://imgur.com/SUWp01Y

    The exit trigger:
    https://imgur.com/tuSsJrX

    As soon as i use the ladder hotspot the player walks to marker and gets constrained on the path fine.

    1.
    Something is wrong though because when i test it sometimes he gets stuck in start of the path (node 0) and can't move up nor down, some other times he only goes up but not down, or he only moves up if i press the down arrow but all these are random every time i use the hotspot.

    2.
    The trigger uses Character: Move along path Action with the Method set to Stop Moving as you suggested. If i manage to move up and enter the trigger nothing happens at all. Brain remains constrained and can't get out of it.

    What am i doing wrong?

    I know i should be using different animations for up & down but i'll get there...
    Let me solve the basics first. :-)

    Thank you
    Dimitri

  • Save the scene as a new scene, and PM it to me - best we're looking at the same thing.

  • ok i sent it, thanks

  • OK. Looks like there are some issues regarding locking the Player to a path in 2D. There's also the fact that - currently - a path-locked Player can only move forward along it, not backward.

    I'll look into these, but I'm not totally sure locking to a Path is actually necessary in this case. Since the ladder is totally vertical, you should be able to get away with just constraining the player's left and right movement, and having Triggers at the top and bottom to free him again.

    Also know that you can use the Engine: Manage systems Action while he's on the ladder to temporarily disable the Interaction system, so that Hotspots aren't interactive during this time.

  • Ok i thought so something was not working because i tried everything with paths. :-)
    It's ok because the ladders in my game will be all vertical, i tried what you suggested and problem solved, thank you. It was that easy after all.

    Last thing i want to ask:
    What are the appropriate actions to set up so the player plays animations for climb up or down depending on what arrow he presses?

    I reach the marker, i tell him to play the climb animation and then?
    Ideally i want to have one animation for UP when player press the up arrow and i want the same animation play reverse when player press down arrow.
    If play reverse is not possible i can have two anims, one for up and another for down, no problem.
    Just tell me please the best way to approach this.
    I'm all ears :-)

    Thank you

  • You can have you character play a different different set of up/down walk animations while attached to the ladder, using the Character: Animate Action.

    How you do this exactly will depend on the character's chosen Animation Engine.

    If set to Sprites Unity, you can drop in another set of up/down walk animations (e.g. LadderWalk_U and LadderWalk_D), and then use that Action's "Set Standard" option to change the name of the character's walk animation to LadderWalk.

    If set to Sprites Unity Complex, you can define a Bool parameter in your Animator Controller that - when True - causes a transition to play only ladder-based animations. You'd then use that Action to just change the parameter's value.

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.