Search the Community
Showing results for tags 'separation'.
-
I have a scene where blocks fall from the sky onto the ground. As they do, they stack up thanks to collision separation. I noticed however that after the stack reaches a height of two or three blocks the incoming block somehow forces blocks at the bottom to lose their separation. I want to stop that from happening. If two blocks collide they should remain separated. I am using the arcade physics, (hope that's not the problem). here is the code window.onload = function() { 'use strict'; var state = { lastCheckin: 0, pandas: null, preload: function () { game.load.image('panda', 'assets/panda.png'); }, loadUpdate: function () { }, loadRender: function () { }, create: function () { game.physics.startSystem(Phaser.Physics.ARCADE); this.pandas = game.add.group(); }, update: function () { game.physics.arcade.collide(this.pandas, this.pandas); var now = Date.now(), delta = now - this.lastCheckin; if (delta > 1000) { this.lastCheckin = now; var panda = game.add.sprite(Math.random() * game.world.width, 0, 'panda'); this.pandas.add(panda); game.physics.arcade.enable(panda); panda.body.gravity.y = 500; panda.body.collideWorldBounds = true; } }, render: function () { }, paused: function () { }, pauseUpdate: function () { }, shutdown: function () { } } var game = new Phaser.Game(320, 480, null, null, state);};