A platform that lifts the player

Hi guys

I am currently developing a 2d platform game where a need a platfrom that the player can walk up onto and be lifted up or perhaps maybe a ladder that the player can climb.

The problem is that i dont know how to code this and i cant really find any examples of it.

Would be awesome if somebody knows how to do this or maybe even has a code example that i can get :slight_smile:

Thank you all for being Great. [import]uid: 120513 topic_id: 20952 reply_id: 320952[/import]

Well a simple case would be where gravity is turned off, then what you would do is when the player collides with the lift platform (create some sort of lift object, make it a sensor). You set the lifts platform velocity to say 10 in the y-direction and also set the players velocity to 10 in the y-direction to create the effect that the lift is pulling the player upwards.

Look up:

object:setLinearVelocity(xVelocity,yVelocity)  

You can do a similar thing for the ladder, except the ladder stays stationary and you set the player’s y-velocity component to say 10 whilst having a climbing animation play, again to create the effect that the player is climbing up the ladder.

Hope this helps. [import]uid: 116225 topic_id: 20952 reply_id: 82858[/import]