Im currently experiencing two issues with Cocoon JS and i am wondering if anyone else has encountered the same issues and can provide me with some insight.
1. Music stops playing after 5-10 seconds. I am loading all my music and sound effects in .mp3 format. My sound effects work fine but again my music stops playing.
2. Fonts are not being drawn.
I am testing my game on my Galaxy S3 and not sure if the issues i am encountering are device related or not.
Any help is appreciated.
1 decade ago
To fix the music issue, there's a special call you can make in CocoonJS to properly play long audio tracks. Check this blog comment
for the details.
I don't know what exactly is causing the problems with the font, though. In hindsight, Impact's font system was a bad idea. It's relying on being able to read back pixels exactly as they are in an image file - which many platforms can't do :/
My suggestion is to log the font
on a platform where the fonts work correctly and then always use these arrays instead of letting Impact analyse the font image.
I.e. on a platform where the fonts work correctly, do this in you Game's
console.log( JSON.stringify(this.font.indices) );
console.log( JSON.stringify(this.font.widthMap) );
this.font.indices = [ /* ... array data here ... */ ];
this.font.widthMap = [ /* ... array data here ... */ ];
Dom, thanks for the help. Its all working now :]
Nice, thanks for the tip :-) Setting the font properties with static arrays fixed also my font issue with CocoonJS + iOS.
At some point fonts were working correctly on my Nexus 7 (CocoonJS) but at the moment I see this. Left screenshot is from Chrome and right is from Nexus 7. Fonts are working on iPad 2 (uses Ejecta) and Samsung Galaxy Tab 2 and Samsung Galaxy S2. Does anyone have any ideas how to proceed?
@tkorkalainen did you find any solution for this?
Page 1 of 1