Jump to content

Collision problem with multiple groups (visible and invisible)


Recommended Posts

Hi everyone!


Still a big fan of Phaser and coming back for another question!


Here is my problem : in my game there are two maps (that should be considered fully different). It is possible for a character to go from one map to the other. The best way to picture this would be, for example, a bonus level within a normal level : you jump in a magic pipe and you land in the second 'bonus' map. But the first map still exists : and everything contained within shall be updated, as the character may go back to it anytime (or other players may still be in it).
I have managed to create two different maps, and I have managed to make my character travel from one map to the other (back and forth), through the "R" key for the moment (no need for a magic pipe yet ;)).
But my characters (both the 'main', playable one, and the 'bot', test one) have a very weird behavior regarding collisions. I can't make them collide with both maps' grounds. And when I eventualy do, travelling from one map to the other breaks it all. The 'bot' goes through the floor and even falls from the sky sometimes!
What is even more bizarre is that the debug green 'hitbox' does not seem to reflect what the debug info display. I can see the box in the scene whereas the y coordinates displayed can be 20 000 or more. Who shall I trust?
Playing with the TILE_BIAS property also gives mysterious behaviors. If I totaly remove it, the 'bot' will fall through the floor on the first main char map-switch, but then will never fall lower than the map's bottom bound.
As I am quite new to Phaser I won't call for a bug that soon, but rather for a bad coding from me. I can't wait to solve this problem and successfuly code this pretty simple setup the good way.
I have attached the project herewith.
Any help would be greatly appreciated!
PS : for simplicity's sake, the two maps are identical, only the colors change. The maps' files (images, tilesets etc.), however, are different, so that the weird behavior might not come from here.


Link to comment
Share on other sites


  • Recently Browsing   0 members

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