CocoonJS Issues
Hi
Doing some testing with the CocoonJS, I detected some issues. The game goes the loading screen, show the main and level select screen but stop when loading level.
The message shown in CocoonJS console is:
Javascript Exception (Line: 787 File: '5110984', Tag: 'timer'): TypeError: Result of expression 'this.tmxDoc.getElementsByTagName' [undefinied] is not a function.
I read on the forum who had trouble loading maps using Tiled and Cocoonjs, would this is the problem?
Another thing, the CocoonJS console show some warnings also:
- Not implemented canvas addEventListener: dbltap
- Not implemented canvas addEventListener: tap
- Not implemented canvas addEventListener: blur
- Not implemented canvas addEventListener: focus
- Not found getElementById: framecounter
Thanks!
Hello! This is a known limitation. See also this ticket, which explains the trouble you are seeing (CocoonJS doesn't export a native XML Parser) - #140
@ciangames @parasyte
I'm closing this one as this is covered by ticket #140 and to avoid duplicating comment.
about the additional warnings, you can ignore them, on my side i got both my "whack'a'mole" and last mini LD entry working under CocoonJS despites these warnings ;)
PS : JSON support is coming soon (should be before the end of the week), check the ticket-140 branch if you want.
Hi Olivier
No problem ;)
About the warnings, would not be a good idea to put a if (!navigator.isCocoonJS) before those functions, disabling the same in CocoonJS?
Thanks!
@ciangames Yes, I guess I can, but these are not harmful when deploying with cocoonJS and (though I cannot always avoid it) I prefer to avoid having platform specific code in melonJS :)
@obiot @ciangames a better workaround would be gracefully handling all platforms that do not have an XML parser. Especially with #140 where it can auto fallback to JSON.
@parasyte sorry just saw this last one ;)
fallback yes that's a good idea, but it means that the JSON map should then always be there, which we cannot ensure. anyway with JSOn being there it should actually become the "default" format in melonJS since it's supposed to be supported by all platforms.