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

Objects and Plugins further reading #12

Closed budda closed 8 years ago

budda commented 8 years ago

Where is the best place to read/understand when best to use the src/scripts/app/objects folder and associated object sub-generator?

rblopes commented 8 years ago

Not sure I understand you question here. Is that related with #11?

budda commented 8 years ago

This is more a general usage of Phaser and objects than anything else.

rblopes commented 8 years ago

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.