Jump to content

Phaser [Isometric Plugin] Overlap / Collision


Sam
 Share

Recommended Posts

I also posted this under the Plugin-post

First of all ~ thank you for this awesome plugin for this awesome framework ~


Overlap / Collision
I have run into a problem which I do not know how to solve or why it happens.
using latesest Phaser 2.1 and isoPlugin.

no big GameCode, small for testing: When I check for overlap or collision in the update fun, nothing happens.
the overlap / collision always returns: false


Create:

this.game.physics.startSystem(Phaser.Plugin.Isometric.ISOARCADE);this.game.physics.isoArcade.gravity.setTo(0, 0, -500); this.player = game.add.isoSprite(300, 200, 0, 'cube', 0, isoGroup);this.player.anchor.set(0.5, 1);game.physics.isoArcade.enable(this.player);this.player.body.collideWorldBounds = true;this.player.body.bounce.set(0,0,0.3);
this.pillar = game.add.isoSprite(400, 100, 400, 'pillar', 0, isoGroup);this.pillar.anchor.set(0.5, 1);game.physics.isoArcade.enable(this.pillar);this.pillar.body.collideWorldBounds = true;this.pillar.body.immovable = true;

Update:

game.physics.isoArcade.collide(isoGroup);game.iso.topologicalSort(isoGroup); this.game.physics.isoArcade.collide(this.player, this.pillar, this.behindObj, this);console.debug(game.physics.isoArcade.overlap(this.player, this.pillar, this.behindObj, this)); //returns false

So I think that I missed something, but don't know what, maybe someone else knows?



Regards

Link to comment
Share on other sites

Found it:

this.player and this.pillar are in the same group.

When I separate this.player into a second group and call:
 

game.physics.isoArcade.collide(isoGroup);game.iso.topologicalSort(isoGroup);

it works. But is this the common behavior?

Do I have to check 2 different groups? And can I not check 2 Sprite in one group against each other?

regards

 

Link to comment
Share on other sites

okay problem was:

calling

game.physics.isoArcade.collide(isoGroup);

and then checking for collision between two sprites.
remove the line above and it works. marked open topic as solved.

just doing the collide with sprite vs. sprite and not the line above - double-checking seems that the second collision gets ignored.

Regards

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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