Ladder Tutorial

wishy

  • Posts: 33
Hi Guys,

So i've been through pages and pages of stuff trying to find a straight forward tutorial explaining how to deploy ladders, i've downloaded a bunch of prefab behaviours/actors etc. and have tried to write my own from scratch using basic logic and hints from the forums but i just can't figure it.

Are there any blog posts or video tutorials that cover this? It's doing my head it!

Cheers

wishy

  • Posts: 33
Bump!

Still havent figured this out and having teribble problems, can anyone please help!?

much thanks

hansbe

  • Posts: 262
Basically I would make the ladder an actor, set the collision to type sensor, set it to cannot move, and make a separate collision group for ladders which only the player can collide with.

Then for the player you need a behaviour. This shouldn't be so different from wall climbing:

If the player is colliding with a ladder and he is not jumping:
  • If he is not climbing, check if up or down key was pressed. If it was, set "he is climbing" and prevent falling. 
  • If he is climbing set x speed and y speed to zero, then if any of the arrow keys are down set x-speed and y-speed to a fixed amount depending on which keys are down.
If he is jumping you should set "is climbing" to false.

There might be some things to add for when the player falls off the ladder, or he collides with a wall, (if you use wall sliding/jumping) when the ladder is next to a wall. It will also be easier to have a separate jump key and climb key, especially if the character is supposed to be able to jump from the ladder. I don't have too much time now, and I don't think I can think this through without doing it, there might be depencies in other movement behaviours. But you should try it out and then post what you got.

-- Edit:
You might want to put what i wrote outside the collision behaviour. In the colliding with ladder-group  behaviour, only set an attribute "collided with ladder" to true, then in a "when updating" behaviour you unset collided at the end. Otherwise there would be no way of unsetting collided, as the collision block would never be called.



« Last Edit: May 31, 2012, 07:39:42 am by hansbe »

wishy

  • Posts: 33
thanks very much, i'll give that a go.

Xietao

  • Posts: 725
Also, you can download the pack "Ladder and Water Pack" (Ignore the Water Regions) and the "Climbing" Behavior
Free Time:
Monday, Wednesday, Friday: 13h
Tuesday, Thursday, Saturday, Sunday: 7h
Loving Linux...

wishy

  • Posts: 33
thank you for the suggestion Xeitao but is there somewhere that I can learn how to actually use the pack? Even a quick list of to-dos?

This is quite embarrassing but i just can get any of the kits to work on my own!

acceleron3000

  • Posts: 9
Okay, here's my How-To guide on how to easily get ladders into your games:
  • Download the "Ladder and Water Pack" pack. To do this, open up Stencyl, and click on the big "StencylForge" button on the top bar. Then do a search (top-right of screen) for "Ladder and Water Pack".
  • Go to the Actor Type for your playable character, and then go to the Behaviors tab. On the bottom left of the screen, click on the "+ Add Behavior" button, and select the "Climbing" behavior. Now just configure the behavior.
  • Now we need to add ladders. First, if you have some ladder sprites, add it to your levels and make sure that it's not collideable. For instance, my ladder sprites were imported as part of a Tileset, so I had to edit the Collision Bounds for those tiles to be "No Collisions". Next, add your fake ladders to a Scene so that we can test them out.
  • In the Scene Editor, select the Add Region tool from the toolbar on the left (it looks like a dark blue square with a green plus sign on its bottom-right corner, and if you mouse over it long enough, a tooltip pops up that says "Add Region (Box)".). Draw a rectangle over your fake ladders, but don't worry about being super accurate. Once you've drawn the rectangle, click on the region you just created, and on the right side of the screen, you'll see that you can now fine-tune the dimensions of the box if you want to be more accurate. But here's the important part: make sure the name of your region is "Ladder".
And that's it! The player will start "climbing" the ladder once they go "Up" while colliding with it, and make sure your ladder movement speed is something other than zero or else it might appear to not work.

Remember that your ladder sprites and the ladder collision regions are not linked to each other. You can easily view your regions at any time in the Scene Editor by choosing the Working Mode that looks like the outline of a square and whose tooltip reads "Work only with Regions". So if you want to add, move, or delete a ladder, remember that you have to change both the visuals and the collision region separately.

Xietao

  • Posts: 725
Also you can use tiles insead actors, "Works With Regions"
Free Time:
Monday, Wednesday, Friday: 13h
Tuesday, Thursday, Saturday, Sunday: 7h
Loving Linux...

wishy

  • Posts: 33
Guys, Thank You So Much!

This was all I needed! thank you.

After following this info, I managed to pick out a couple of things that I was doing incorrectly (tile collision was something I was forgetting about mainly).

Thanks again!

nachochef

  • Posts: 3
Hello, I am new to stencyl and I need help with the stairs. I can not find the stairs and water pack, it is the same as the ladder ladder.




Okay, here's my How-To guide on how to easily get ladders into your games:
  • Download the "Ladder and Water Pack" pack. To do this, open up Stencyl, and click on the big "StencylForge" button on the top bar. Then do a search (top-right of screen) for "Ladder and Water Pack".
  • Go to the Actor Type for your playable character, and then go to the Behaviors tab. On the bottom left of the screen, click on the "+ Add Behavior" button, and select the "Climbing" behavior. Now just configure the behavior.
  • Now we need to add ladders. First, if you have some ladder sprites, add it to your levels and make sure that it's not collideable. For instance, my ladder sprites were imported as part of a Tileset, so I had to edit the Collision Bounds for those tiles to be "No Collisions". Next, add your fake ladders to a Scene so that we can test them out.
  • In the Scene Editor, select the Add Region tool from the toolbar on the left (it looks like a dark blue square with a green plus sign on its bottom-right corner, and if you mouse over it long enough, a tooltip pops up that says "Add Region (Box)".). Draw a rectangle over your fake ladders, but don't worry about being super accurate. Once you've drawn the rectangle, click on the region you just created, and on the right side of the screen, you'll see that you can now fine-tune the dimensions of the box if you want to be more accurate. But here's the important part: make sure the name of your region is "Ladder".
And that's it! The player will start "climbing" the ladder once they go "Up" while colliding with it, and make sure your ladder movement speed is something other than zero or else it might appear to not work.

Remember that your ladder sprites and the ladder collision regions are not linked to each other. You can easily view your regions at any time in the Scene Editor by choosing the Working Mode that looks like the outline of a square and whose tooltip reads "Work only with Regions". So if you want to add, move, or delete a ladder, remember that you have to change both the visuals and the collision region separately.

nachochef

  • Posts: 3
Hello, I am new to stencyl and I need help with the stairs. I can not find the stairs and water pack, it is the same as the ladder ladder.

ironhide1975

  • Posts: 2
Can someone post a picture of the logic for a ladder (or a video) I found one video on YouTube and that's it.
Also I can't find the 'ladders and water' pack. Can someone post a link?

merrak

  • *
  • Posts: 2738
I don't remember if one of Luyren's resource packs contains a ladder behavior, but it would be worth checking out: https://luyren.itch.io/

FYI most of the conversation has moved over to the Discord. I'm not sure how many people regularly check the forums anymore... so you may want to hop onto the chat and post your question there.