Jump to content

Phaser platform ladder aka lode runner


metalslug87
 Share

Recommended Posts

hello,

I am searching for effective way of ladder climb for player like in old Loder Runner game for NES :).

I already have only simple script in Update function, if the player overlaps 2 hidden objects on both sides of the ladder he gains the ability to climb. In fact it's hard to accurate get the player at the center point of ladder to climb it. Any Ideas ? :)

if (playerTouchLeftLadder && playerTouchRightLadder) {
        console.log('overlaps ladder');

        if (cursors.up.isDown) {
            player.body.velocity.y = -75;
            playerGravity = 0;
            player.frame = 9;
            onLadder = true;
        }else if (cursors.down.isDown) {
            player.body.velocity.y = 75;
            playerGravity = 0;
            player.frame = 9;
            onLadder = true;
        }else if (playerJumpState == false){
            player.body.velocity.y = 0;            
        }

    }else{
        playerGravity = 500; 
        onLadder = false;    
    };

 

Link to comment
Share on other sites

  • 2 months later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...