Phaser for Beginners

Organizing your folders

You should be proud of your first game, but having a look at your project folder it looks a bit unorganized.

We have images, sounds and scripts all placed in the same folder. This is not a big problem when you are dealing with simple games like this one, but imagine a bigger project with a lot of images and sounds: you will end with a folder full of clutter.

That’s why you should create a folder called assets, with more folders in it called sprites and sounds where to place all your files. You can give your folders the names you want, but keep in mind there are the names I will be using in future books and tutorials. Now your project will look like this:

Now it’s more organized, and we just have to edit the preloading paths. This is how we change preload method in playGame object:

And the same concept applies to preload method in titleScreen:

And now we have the same working game, with more organization.

Download Source

File: organizing-folders-game.zip


Next Tutorial →

Creating a preloader state

← Previous Tutorial

Saving high score

Leave a Reply

Your email address will not be published. Required fields are marked *