Get enemies to climb ladder?

andrew03123

  • Posts: 4
I've spent several hours searching for this on here and google, I can't seem to find any guidance on how to make an enemy climb ladders, best I've managed to do is attach the climb ladder behaviour to the enemy but I'm not sure how to make it automated from here.

colburt187

  • *
  • Posts: 2270
There are several ways to approach this, how do you currently move your enemies? do they have gravity enabled?

andrew03123

  • Posts: 4
I'm looking to make a 2D platformer where the enemies can only follow me horizontally and up/down ladders. I've tried using the follow target behaviour which had them floating towards me, so I disabled the Y axis tracking which left them only able to following me horizontally (I'll implement a range limit as well so they're not chasing me non-stop), now I'm really hoping for some guidance on having them follow me up ladders as well!

JeffreyDriver

  • Posts: 1860
Are your ladders tiles? If so, there are blocks for getting data from a tile.

SCENES > WORLD > TILES

You can then check if your enemy is over a ladder tile or not. Then you just need to create your logic prevent horizontal movement and make your enemy move up or down the ladder as needed. For example, if the player is above the enemy, and the enemy is over a ladder, stop it from moving left/right, and make it move upwards until it's no longer over the ladder. At which point you disable vertical movement and enable horizontal  movement
Current Projects:
Retro Redux Compilation (NEW).
Retro Redux (untitled) (NEW).
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

andrew03123

  • Posts: 4
My ladders are tiles, with a region 'LADDER' surrounding those tiles, which allows my player to climb the ladder/region. I'm brand new to all this, so would greatly appreciate a screenshot of what you mean code wise!! 


JeffreyDriver

  • Posts: 1860
There's quite a few things to take into consideration, but see a basic example attached. This example will need tweaking to fit your particular circumstances. You'll need to add the text data 'ladder' to the correct tiles, and you can delete the regions.

Other things to consider are as you're climbing up/down ladders, you'll need a way to check when you're at the top or bottom.  One way to do this would be to have three ladder tiles; your main one with the data 'ladder', one with 'ladder top' and one with 'ladder bottom'. Of course this then starts to make things more complicated.

Also, what happens if the player is on the same platform, but the enemy is on a ladder tile?
Current Projects:
Retro Redux Compilation (NEW).
Retro Redux (untitled) (NEW).
I always appreciate useful feedback. Thank you.
www.jeffreydriver.co.uk

andrew03123

  • Posts: 4
Sorry for the late reply, I haven't worked on my game in over a week but I'll try and put this to work now, thanks heaps!