Closed budda closed 8 years ago
Not sure I understand you question here. Is that related with #11?
This is more a general usage of Phaser and objects than anything else.
Basically, extended classes (or prefabs) are useful for adding custom behaviour and features that the basic objects don't provide. You create prefabs for things needing one to multiple instances in a game. That's pretty much it.
For example, if you have a racing game, much probably you'll need a Car
Sprite, defining its appearance, behaviour and properties. If you want your car to move, you'd add a #move
method to your Car
class with all physics logic encapsulated.
I think people elsewhere have covered it much better than I, there are many tutorials on the subject out there, like this one covering a Metroid remake and how to make an Enemy class.
Of course, you need some good understanding of the Phaser API to author your custom classes too. Sometimes reading the Phaser source codes to understand how things work internally may help too, some good insights there.
As for the folders, they are only a convention to help best organize code.
Where is the best place to read/understand when best to use the src/scripts/app/objects folder and associated object sub-generator?