Jump to content

Overlapping Arcade Physics bodies don't separate


jmp909
 Share

Recommended Posts

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);}

thanks

J

 
 

post-16536-0-74029800-1443636207.jpg

Link to comment
Share on other sites

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" behaviour

Thanks

J

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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