melonJS icon indicating copy to clipboard operation
melonJS copied to clipboard

CocoonJS Issues

Open aaschmitz opened this issue 13 years ago • 6 comments

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!

aaschmitz avatar Mar 03 '13 18:03 aaschmitz

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

parasyte avatar Mar 03 '13 18:03 parasyte

@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.

ghost avatar Mar 06 '13 01:03 ghost

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!

aaschmitz avatar Mar 06 '13 02:03 aaschmitz

@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 :)

ghost avatar Mar 06 '13 02:03 ghost

@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 avatar Mar 06 '13 03:03 parasyte

@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.

ghost avatar Mar 21 '13 14:03 ghost