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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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