Getting character to climb a ladder with a click

0 favourites
  • 7 posts
From the Asset Store
You should help Choli to climb the mountain and reach its peak
  • Hey guys,

    I'm running out of ideas here.

    I'm trying to make a point n' click platformer with some pathfinding.

    I want the character to climb ladders when they are clicked and go down if he is upstairs.

    I find my implementation logical but it doesn't seem to be getting the work done.

    Could somebody explain me why?

    I'm attaching the project here.

    Thanks!

    dropbox.com/s/62fbk8fo8l6a59e/pointnclickplat.capx

  • Can't link on this site yet so just go to the tutorials and search for ladders, there's a slick tut called "A Simple Method for Climbing Ladders in Platformers", I think this will help you. <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Bertie,

    Thank you for the suggestion but I know how to do what's explained in that tutorial. I need help specifically with my point n' click situation, which is different.

    Thanks!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • can't seem to download your example file right now, but here's how i would do it.

    create 2 image points for your ladder. (1 = top of ladder, 2 = bottom of ladder)

    On mouse click on object "ladder".

    (sub event) system compare 2 values distance(player.x, player.y, ladder.ImagePointX(1), ladder.imagePointY(1))

    < distance(player.x, player.y, ladder.ImagePointX(2), ladder.imagePointY(2))

    This checks the distance between the player and the 2 image points. If image point 1 is closer to the player, then you know he's near the top of the ladder, if point 2 is closer, then he's closer to the bottom of the ladder.

    Next, move the player automatically to the proper imagepoint location, then play the ladder climbing animation, while he automatically moves the other image point.

  • I think that's pretty much what I did!

    I'm kind of proud my logic made sense then :D But I still must be doing something wrong.

    I don't understand why you can't download the file :S Just sent it to a friend and it seems to work.

    Would you mind trying again, please?

    Here's a screenshot of my eventsheet just in case.

    i.imgur.com/BCvcmLG.png

  • Ok, so there are multiple problems here. (I managed to download/test it).

    First, name your sprites. I renamed them, it's a lot more simple to read.

    Second, you don't use the pathfinding behavior right. First "Find path", then in another event, you use the trigger "on path found", and then you move along path. I changed it in the code.

    Using this correctly, and using image points where I want the character to go exactly (in the **middle** of the top and bottom sides), it works more like you wanted it.

    Another problem there were was the top of the ladder not being solid, and we would fall through as the platform behavior was resumed. You may have did it so the pathfinding works, but I put again the solid behavior, witch I deactivated, as well as the collisions, in the editor. I activate them as soon as you click on the first ladder. The pathfinding won't be bothered by the solid, as it has already calculated its obstacle map.

    Here is the link.

    Feel free to ask if anything isn't clear :)

  • This comes like 2 weeks late but, thank you very much Guizmus! That made it very clear for me. Awesome.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)