I'm working on my 2d platformer state machine setup and hit another roadblock, this time related to ladders and specifically, how to dismount them.
I've looked over the examples but they either allow for Y movement on the ladder(I want the character locked to the center of the ladder on Y while climbing) or they require a separate key binding to dismount.
What I want is to have the player exit the climb state when they reach the ground (I have this working) or when they press left or right when they are within a few pixels of a platform adjacent to the ladder (not yet working).
I want pressing right arrow to dismount onto the platform to the right.
<img src="http://i45.tinypic.com/fjiagj.png" border="0" />
I assume I need to find a way to compare the playerCapsule and Tile's Y position but I'm not having much luck doing it. I'm still unclear on how to have it compare the nearest tile value, or how to set a small range of pixels that will allow the dismount. I suspect the solution lies with allowing the Player to continue to climb when there is Collision with a tile but to dismount when their Y origins line up with an offset.
The .capx is here:
The climbing "code" are in events 17-22.
Thanks in advance for any help.