Jump to content

Preloader image not loading , Can someone please help !`


Rahul_Martin
 Share

Recommended Posts

Hi ,

 

i am new to phaser , and can't resolve this problem from about a day wasted on it. while preloading my image does not show , i have attached a snapshot .

 

here is the code i have used for preloading

 

 

function preload()

{

game.load.image('preloaderbar','assets/preloaderbar.png');
LoadingProgress = game.add.sprite(game.world.centerX-100,game.world.centerY,'preloaderbar');
game.load.setPreloadSprite(LoadingProgress,0);
}
 
Thanks in advance.

post-9101-0-59295200-1402319621.png

Link to comment
Share on other sites

  • 2 weeks later...

I have the same problem. How do I implement the simplest boot state possible? Everything else in my game is done, and I don't wanna mess with it unless I have to.

 

I tried with adding "boot : boot" in the game init, and also a boot function, but that didn't work.

 

var game = new Phaser.Game(width, height, Phaser.AUTO, 'phaser_game', {boot : boot, preload: preload, create: create, update: update  });
 
Any ideas?
Link to comment
Share on other sites

I retrofitted one of my games and it was as simple as taking the basic game template from the phaser master repo, putting preloader in preloader.js, update and create in game.js and adjusting the the boot state to my preferences, and then find&replacing "game." with "this." everywhere.

Link to comment
Share on other sites

var game = new Phaser.Game(width, height, Phaser.AUTO, 'phaser_game', {boot : boot, preload: preload, create: create, update: update  });

 
Any ideas?

 

Wrap your original functions into an own object, then make another game-state-object, that loads the needed pictures and starts your original gamestate. Something like that:

var originalGamestate= {preload: preload, create: create, update: update};var preloader={   preload:function(){     game.load.image('preloaderbar','assets/preloaderbar.png');   },   create:function(){    game.state.start('originalGamestate');   }}var game = new Phaser.Game(width, height, Phaser.AUTO, 'phaser_game');game.state.add('orginalGamestate', orginalGamestate);game.state.add('preloader', preloader);game.state.start('preloader');
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...