rblopes / generator-phaser-plus

[🛑 DISCONTINUED] It has been a long journey but development of `generator-phaser-plus` is now over. I recommend you have a look and fork `yandeu/phaser-project-template` instead.
https://github.com/yandeu/phaser-project-template
MIT License
144 stars 14 forks source link

Handling assets preloading #33

Closed budda closed 5 years ago

budda commented 5 years ago

How is asset preloading handled in this version?

In Generator Phaser+ v2 there was in src/assets.js file with an array of files in - and then a states/PreLoader.js to load it all in. I don't see anything in the new structure that gets generated?

I noticed in your snake game repo you've added an extra constants directory and stuck an assets.js in there. Is that the new intended way but it's missing from the auto-generated files at the moment?

rblopes commented 5 years ago

The Snake game example is a pretty old experiment and looks nothing like the current sample project anymore. It now contains some unrelated stuff. I'll probably start something else and label it a demo later (granted I have free time for that, anyway.)

From now on, game assets should be declared in the splash screen scene using regular Loader calls.

As stated a few issue reports back, the sample project used to include an assets.js module the same way older versions did. After fighting some of the new “Phaser-isms”, however, I decided to downgrade the code. There was not much documentation on the new asset pack format at that time and given I couldn't provide a proper one for use with generator-phaser-plus just yet, I decided it would be best to remove it. Learning the Phaser 3 API is enough cognitive overload already, especially for newcomers. Better rely on something people are more familiar with, and given that many people will learn to code their first games from tutorials these days, that would be better to keep it that way.