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

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...
 Share

  • Recently Browsing   0 members

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