Jump to content

Is there a way to load everything beforehand?


Hynx
 Share

Recommended Posts

I have a project that I've been working over the past week, and basically it is like this:
 

Intro screen with a menu
Main game 

Gameover screen

 

When start the page it loads the files for intro screen, when I click start it loads again for the files for the main game, and when I lose and try again it loads all again for the main game.

 

Is there a way to load everything at once so I don't have these loads between states?

Link to comment
Share on other sites

Indeed there is!

Rich, our benevolent overlord, refers to a Boot State, in which preloader assets are loaded, and a Preloader State, in which all other assets are loaded.

There is even a basic template that you can look at and use that has these set up already.... somewhere... I can never remember which folder it is in....

 

Ah, here it is: phaser\resources\Project Templates\Basic

 

Essentially, all you need to do is add two more states to your existing list, and fill in the blanks in the template files.

Link to comment
Share on other sites

FYI, you can actually load any assets in any state; Phaser gives you the freedom to handle this however you should so desire. if you wanted, you could load every asset for the game before your intro screen. (but loading like this makes it more difficult - though not impossible - to present a nice "loading" UI, so having at least a 'preloader' state that loads your assets for said UI - progress bar graphic etc - usually makes sense). loading assets for particular states makes sense as a game grows larger and when those assets are only needed for a particular state.

 

and of course xekedeath's suggestion of using the template is a good one - after all, that's what it's there for!

Link to comment
Share on other sites

Indeed there is!

Rich, our benevolent overlord, refers to a Boot State, in which preloader assets are loaded, and a Preloader State, in which all other assets are loaded.

There is even a basic template that you can look at and use that has these set up already.... somewhere... I can never remember which folder it is in....

 

Ah, here it is: phaser\resources\Project Templates\Basic

 

Essentially, all you need to do is add two more states to your existing list, and fill in the blanks in the template files.

Wow, thanks a million, I'm still a noob on this and I'm rushing for the Candy Jam. Thanks!

Link to comment
Share on other sites

Candy Jam..? Damn, if I had known about that earlier, I would have made Bubble Candy Witch Crush Saga, a Bejewelled/Bust-a-move mash up where you shoot candy from the bottom of the screen into the candy at the top, and then you can swap them around to match 3...!

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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