Jump to content

weirdest phaser bug - every sprite suddenly sits in the upper left corner


Recommended Posts

in my phaser game i found a bug (it is really hard to reproduce and there is no error message in the console when it happens but i manage to hit the bug when i try long enough) where every single sprite in my game world suddenly sits in the upper left corner, unscaled, unrotated, still animated but no physics anymore..  input events come through so my player still makes the jump move for example (but of course doesn't jump)



i encountered the very same thing a while ago on a phaser update where i worked with some attributes on objects i created from tiled object layer and those attributes weren't there anymore because of some changes in 2.0.4 (rich made a few changes and since then it works fine)  


but this time it is differen everything works fine.. until... 


my player has an anchor with a rope that he can shoot and with this tool hang on every wall - when i shoot the anchor often enough on a sprite (created from an object) i think i need to shoot between the sprite and the tilemap wall (there is no gap but the anchor sometimes slips through a little bit) and bam!  everything is mashed together and fixed to the upper left corner..


EDIT:  i think one reason why i encountered this bug when shooting the anchor between the sprite and the "thin" wall is that the anchor (maybe) at some point flies through the wall (which is positioned on the very left side of the game world) and then tries to anchor it self outside of the game world ????    (i catch the point where a first shot sensor hits the wall and create a new anchor sprite at the very same point to anchor my rope)

EDIT2:  i guess not.. i created the wallanchor outside of the world on purpose and couldn't trigger the bug..


i have absolutely NO idea what is happening so i ask here.. maybe someone as an idea...   




Link to comment
Share on other sites

hmm..  well i think i found something..  for now it looks like my player has to be involved for this bug to happen.. when i shoot the anchor/chain without creating a revoluteConstraint between my player and the last chain so the player sits still and does nothing.. the rope flies on its own..    i couldn't trigger the bug..  ( i just clicked for 5 minutes like a psychopath on my mouse and nothing happend)


normally my player gets pulled away from the shot .. the chain/anchor is so fast and only gets stopped when it hit something that my player always makes a little jump into the shot direction because of the constraint..


but it is no problem for my player and the rope and all the constraints to reside outside of my gameworld so this isn't it

Link to comment
Share on other sites

To see something in the console must be a warning, an error , or something you output with console.log() 

Write somewhere after the creation of those sprites, in the bottom of the create function maybe, and use the command with the sprite you want to output.

Like console.log ( sprite )  

Link to comment
Share on other sites

oke.. i placed several console logs all over my code to pinpoint the place where the exception occurs..


this was a hard one to crack.. 


when the player stands exactly beneath a wall the moment he fires the chainanchor my function for calculating the chain-length returns 0 - then the crysis stars :)  i didn't exactly find out where this leads to a problem but i definitely found out some of my further calculations and functions will cause this crash so i added a simple:

 if (chainLength != 0){  createChainElement(0, chainLength); }



thank you all for your help... 


but even if something i wrote was responsible for the error i find the way phaser/p2 reacts really  "uncool"

Link to comment
Share on other sites


  • Recently Browsing   0 members

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