Sign in to follow this  
coderNull

Ladder Collision and Implementation in Platformers

Recommended Posts

coderNull    103

Hi guys, I just have a quick question about how to implement ladders into my new platformer game that uses a tile map system. How would the collision work out? I know it has something to do with the collision class because if a ladder would negate the platform collision rules, I just don't know how to get it started. Any help would be greatly appreciated, thanks. 

Share this post


Link to post
Share on other sites
MrCodeSushi    1066

Let's say you have two code paths; one for the normal jump behavior, and the other one for the ladder climbing behavior. Your tiles could have a type that represent what type of object it is; i.e wall, water, spike, ladder. When you player hits the "jump" button, you can check the current tile you're player is in, rect-to-rect intersection test, then check that rectangle's type. If its a ladder, then perform the ladder climbing behavior. If there is no tile that exists, or a non-ladder tile, then you can perform the normal jump code path behavior. 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this