Possible JSON export glitch breaking Phaser callbacks

Report problems here (or use the built-in feedback dialog in the editor)
Post Reply
bvargish
Posts: 26
Joined: Fri Oct 02, 2015 4:17 pm

Possible JSON export glitch breaking Phaser callbacks

Post by bvargish » Mon Nov 02, 2015 9:35 pm

I'm loading different scenes created in R.U.B.E. into Phaser and using setBodyContactCallback to detect a body's collision with sensors. The callbacks were only working for one of my levels for some reason. I compared every aspect of the body and sensors and all of the parameters were set the same. I thought maybe that too many bodies were on the screen for the one level (I haven't optimized it yet) so I deleted a bunch and re-exported. Still no callback. Then I undid my delete and re-exported again. Suddenly my callbacks worked. Though this seems to indicate a caching issue, I was clearing my cache in Firefox, so it's possible something is going on with the JSON export. I attached both the original broken level and the re-exported working level for your review. I will report back if I gain any other insight into this. I moved the sensor (sensorAnt) right on top of the body (dung) for now so it's immediately triggered. It's in the upper left corner of the screen.
Attachments
level9_clone.rube
(75 KiB) Downloaded 1006 times
level9_clone_broken.rube
(75 KiB) Downloaded 1022 times

bvargish
Posts: 26
Joined: Fri Oct 02, 2015 4:17 pm

Re: Possible JSON export glitch breaking Phaser callbacks

Post by bvargish » Mon Nov 02, 2015 9:39 pm

Oops just realized I should have attached the JSON files. If I encounter this on another level I'll attach them. I no longer have the old JSON file.

iforce2d
Site Admin
Posts: 860
Joined: Sat Dec 22, 2012 7:20 pm

Re: Possible JSON export glitch breaking Phaser callbacks

Post by iforce2d » Tue Nov 03, 2015 7:56 am

I'm not sure what you mean by "re-exported"...
This isn't really something that can be checked by just looking at the .rube file, because it depends on the interaction between your code and the settings in the .rube file (eg. how do you obtain a reference to the bodies to set the callback for etc.)

bvargish
Posts: 26
Joined: Fri Oct 02, 2015 4:17 pm

Re: Possible JSON export glitch breaking Phaser callbacks

Post by bvargish » Tue Nov 03, 2015 8:08 pm

By re-export I meant Export scene > Save raw info (JSON).

Please ignore this for now. If I can reliably duplicate this I'll provide all the files.

bvargish
Posts: 26
Joined: Fri Oct 02, 2015 4:17 pm

Re: Possible JSON export glitch breaking Phaser callbacks

Post by bvargish » Wed Jan 06, 2016 2:57 pm

Just a note that I was able to duplicate this numerous times. I would add a sensor to an existing scene, export to JSON, and add a callback in Phaser. The callback wouldn't work. Then I would delete a bunch of stuff in my RUBE scene, export to JSON, reload in Firefox (the game would be broken in my case), undo the stuff I deleted, export to JSON again, reload in Firefox and the callback worked.

I really think this is some weird Firefox caching issue rather than a RUBE bug, so I'm posting this in case anyone else who runs into this problem knows the solution!

iforce2d
Site Admin
Posts: 860
Joined: Sat Dec 22, 2012 7:20 pm

Re: Possible JSON export glitch breaking Phaser callbacks

Post by iforce2d » Thu Jan 07, 2016 9:50 am

What happens if instead of doing the 'export to JSON' step again, you just replace the file on disk? ie. leave RUBE out of the sequence completely.

Post Reply