Sign in to follow this  
Sam

Phaser [Isometric Plugin] Overlap / Collision

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

Share this post


Link to post
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

 

Share this post


Link to post
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

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.