Quasar Posted July 8, 2014 Share Posted July 8, 2014 Hey everyone, I'm pretty new to Phaser and was wondering if there was a nice way to implement rope-climbing in my game?Using Arcade physics, I can only think of checking for contact with the rope/ladder and setting the player's gravity to 0 while they're on the rope.. but it doesn't seem very clean - does anyone have any tips/tricks? Link to comment Share on other sites More sharing options...
valueerror Posted July 8, 2014 Share Posted July 8, 2014 in my game i use a separate (invisible) layer on which i paint little arrows where the ropes are (the ropes are of course visible on the background or foreground layer) .. so in the game - when my player pushes the "up" button of the controls i check on this invisible layer if there is a tile.. if so player.body.moveUp(200) as long as the "up" button is pressed .. there are several more hacks to make it work smoothly like checking if there sitll is rope infront of the player and if not stop the animation and don't allow to move up further.. and using no gravity while in "climbmode".. so the player can "hang" on the rope and not fall down and of course when moving left or right check again if the player is still on the rope and if not get back gravity... Link to comment Share on other sites More sharing options...
lewster32 Posted July 8, 2014 Share Posted July 8, 2014 Yeah, turning gravity off seems to be the standard way to handle climbing mechanics in most games. You disable gravity and then manually control the velocity of the player as valueerror suggests. Some games also disable you from moving left or right while climbing except at the top or bottom, but this is of course optional. Link to comment Share on other sites More sharing options...
Recommended Posts