Jump to content

Problem with resize


Elinchat
 Share

Recommended Posts

Hello, I want to find how can I fix this problem about two players's hitboxes.

When I press down, I change ths size of the hitbox but it go throught the other hitbox.

 

function deplacementJoueur2(){
    joueur2.body.velocity.x = 0;
    // joueur2.animations.stop();
    joueur2.frame = 0;

    if (toucheQ.isDown) {
        joueur2.body.velocity.x = -400;
        joueur2.animations.play('left2');
    }if (toucheD.isDown) {
        joueur2.body.velocity.x = (400);
        joueur2.animations.play('right2');
    }if (toucheS.isDown) {
        joueur2.frame = 27;
        joueur2.anchor.setTo(1, 1);
        joueur2.body.setSize(110/2, 122/2);
        
        joueur2.animations.play('down2');
    } else {
        joueur2.body.setSize(110,122);
    }
    if (toucheZ.isDown && game.time.now > jumpTimer2) {
        joueur2.body.velocity.y = -300;
        jumpTimer2 = game.time.now + 750;
        joueur2.animations.play('jump2');
    }
}

Mar 17 2017 4-20 PM - Edited.gif

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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