Game not working on first load, works properly on 2nd load.


Hi y’all. so i created a game using cocos2d-x html5. im using version 2.2.2,

in certain browsers, specially on the safari browser on mobile, the game completes load, but does not show the sprites or sound yet (missing sprites), it works perfect on chrome and IE but has this problem on other browsers.

if i hit refresh, it reloads the game and the assets are working properly.

any insight on this? my resource looks like this. note: i cut quite a bit of it but the format is like this.

var mc_Barrel_plist = "res/mc_BarrelPlist.plist";
var mc_Barrel2_plist = "res/LogoBarrel_plist.plist";

//regular sprites

var res_HelpSprite1 = "res/start_06.png";
var res_HelpSprite2 = "res/start_07.png";

var pokeFont59 = "res/pokeFont59.fnt";
var pokeFont40_ry = "res/pokeFont29_ry.fnt";

var bgm00 =  "res/sound/bgm00.mp3";
var bgm01 =  "res/sound/bgm01.mp3";

var g_resources = [
    {src:res_HelpSprite2} ,
    {src:mc_Barrel_plist}  ,
    {src:mc_Barrel2_plist}  ,
    {src:pokeFont59}   ,

    //loading fix
    {src:"res/pokeFont29_ry.png"} ,



Does anything appear in the console?


no nothing out of the ordinary.


I had a similar problem using Tiled (tmx) files:

If you use a tmx file called “myMap.tmx” and in it you use several images, let’s say “tiles01.png” and “tiles02.png”, you need to preload on your resources not only the tmx map, but also all images that you use on it, otherwise you get the same error that you describe.

I haven’t worked with plists yet, but can you check if all the images that you are referencing within the plist file are also loaded as separate images within your resource file (and if that fixes the problem)?