Phyron Posted August 26, 2014 Share Posted August 26, 2014 Hi! I have a problem with breakout game. Create bricks:this.bricks = this.game.add.group(); this.bricks.enableBody = true; this.bricks.physicsBodyType = Phaser.Physics.ARCADE; var Level = this.blockPacks[level]; var tempBrick; for (var y = 0; y < Level.bricks.length; ++y) { for (var x = 0; x < Level.bricks[y].length; ++x) { tempBrick = this.game.add.sprite(x * 32 + 48, y * 16 + 64, 'tiles',Level.bricks[y][x]); this.bricks.add(tempBrick); } }Object of block bricks: this.blockPacks = [ { name: "Fish", bricks: [ [0, 0, 1, 1, 1, 1, 1], [5, 2, 2, 2, 2, 2, 2], [4, 5, 4, 2, 3, 4, 4] ] } ]And ball is a simple sprite. check overlap:this.game.physics.arcade.overlap(this.balls, this.bricks, this.ballVsbrick, null, this);And destroy: ballVsbrick: function(_ball,_brick){ _brick.kill(); _ball.kill(); },Work fine, but if i kill some brick, other brick also destroy, in ifrst contact destroy the brick overlaped and always the same other brick, and the second overlap, destroy other brick, and after work fine. I bold in object brick two bricks are destroyed. Thenks and excuse my english Link to comment Share on other sites More sharing options...
Recommended Posts