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


#1

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 = [
    //image
    {src:res_HelpSprite1},
    {src:res_HelpSprite2} ,
    {src:mc_Barrel_plist}  ,
    {src:mc_Barrel2_plist}  ,
    {src:pokeFont59}   ,
    {src:pokeFont40_ry},
     {src:bgm00},
    {src:bgm01},
  

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

];

#2

Does anything appear in the console?


#3

no nothing out of the ordinary.


#4

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)?