Jump to content

Gravity Makes Bottom Object Vibrating


yigitozdemir
 Share

Recommended Posts

Hello,

I am creating a "break bricks" clone.  I want to make objects fall with arcade physics. I enabled arcade physics and i made every brick collides with world bounds and each other.

When i enable a brick's gravity on y axis, they fall behind other bricks and vibrate. Here is my code to create bricks.

function drawBricks(){
    brickObjectList = new Array(10);
    brickGroup = game.add.group();

    for(var i = 0; i < brickList.length; i++){
        brickObjectList[i] = new Array(10);
        for(var j = 0; j < brickList[i].length; j++){
            var brickKey = getAssetName(brickList[i][j]);

            var brickObject = game.add.sprite(leftSlack + (i * 60), topSlack + (j*60), brickKey);
            game.physics.enable(brickObject, Phaser.Physics.ARCADE);

            brickObject.inputEnabled = true;

            brickObject.body.collideWorldBounds = true;

            brickObject.body.checkCollision.down = true;
            brickObject.body.checkCollision.up = true;
            brickObject.body.checkCollision.left = true;
            brickObject.body.checkCollision.right = true;

            brickObject.body.gravity.y = 20;

            brickGroup.add(brickObject);

            brickObject.events.onInputDown.add(clicked, {x: i, y: j});

            brickObjectList[i][j] = brickObject;
        }
    }
}

And here i recorded a gif, what is actually happening:

http://imgur.com/qiSPwaT

Do you now what is the problem? How can i solve that problem?

 

Thank you for your help.

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...