jmp909 Posted September 30, 2015 Share Posted September 30, 2015 Hi, I've set up a group of sprites and they generally collide with each other fine, but if they are overlapping they don't separate (ie force each other apart). Is this only available with other physics types like Box2D or have I missed something?create() { this.enemiesGroup = this.game.add.group(); this.enemiesGroup.enableBody = true; this.enemiesGroup.physicsBodyType = Phaser.Physics.ARCADE; for(var i=0; i < 20; i++) { var enemy:Phaser.Sprite = this.enemiesGroup.create(game.rnd.integerInRange(100, 770), game.rnd.integerInRange(0, 570), "gameboy", game.rnd.integerInRange(2,5)) enemy.name="enemy"+i; enemy.body.bounce.y=0.8 enemy.body.collideWorldBounds=true; }}update() { this.game.physics.arcade.collide(group, group, this.groupCollisionHandler, null, this);}thanksJ Link to comment Share on other sites More sharing options...
bruno_ Posted October 1, 2015 Share Posted October 1, 2015 if they are overlapping they are not colliding. What are you trying to achieve in your handler? Try not to overlap them when you are creating them with the random positions. Link to comment Share on other sites More sharing options...
Skeptron Posted October 1, 2015 Share Posted October 1, 2015 I think they need a velocity so that Phaser knows where to "repulse" them Link to comment Share on other sites More sharing options...
jmp909 Posted October 1, 2015 Author Share Posted October 1, 2015 Hi,Wasn't trying to achieve anything specifically so far, it was just a basic example and I wanted to know if I was doing anything wrong or if it was a bug. I'll try and ensure they're not generated on top of each other then if it's "expected" behaviourThanksJ Link to comment Share on other sites More sharing options...
Recommended Posts