Rahul_Martin

Preloader image not loading , Can someone please help !`

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

Share this post


Link to post
Share on other sites

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?

Share this post


Link to post
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.

Share this post


Link to post
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');

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.