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

 Share

  • Recently Browsing   0 members

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