Jump to content

bug? restart the same state exactliy 5 times and p2 collisions are gone


valueerror
 Share

Recommended Posts

Huh Yesterday I played the game and at some point Mario started falling trought the floor...

 

I decided that's a developers bug and just refreshed and everything was cool :P

 

It's nice to know the real reason for this. 

Link to comment
Share on other sites

I'd put good money on p2 having run out of bitmasks, so it can't create any more collision groups. To check if this is the case or not, could you try this please:

 

When your state shuts down (so create a state shutdown function if you don't have one already) put this code in:

game.physics.p2.world.off("beginContact", game.physics.p2.beginContactHandler, game.physics.p2);game.physics.p2.world.off("endContact", game.physics.p2.endContactHandler, game.physics.p2);game.physics.p2.collisionGroups = [];game.physics.p2._toRemove = [];game.physics.p2.boundsCollidesWith = [];game.physics.p2._collisionGroupID = 2;game.physics.p2.postBroadphaseCallback = null;game.physics.p2.callbackContext = null;game.physics.p2.impactCallback = null;
Link to comment
Share on other sites

Hah bloody hell, of course. What does P2.clear down? Clears all bodies from the world. What are the world bounds? A body :) And because p2 already exists, when the state starts again it never gets re-created. If you create your own 'floor' body you'll see it works fine, over and over I think. I'll carry on working through this here.

Link to comment
Share on other sites

thx for the build file..  didn't find the time (yet) to learn how to work with grunt..  

 

 

i'd say.. Problem solved in dev branch !!

 

 

(i've got a few other interesting things for you ^^)

 

did you stumble over this one? 

http://www.html5gamedevs.com/topic/4406-2-possibe-bugs-with-phaserbutton/#entry27288

 

 

thx again for all the work!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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