Even if I didn’t have any reply to my proposition of making a collective boilerplate, I started working on it. I’ve already made a topdown and a side-scroller example. They both mostly use the same code, making features available on both version. On both example, you can talk to non playable characters, you can shoot fireball while pressing CTRL, you’ll have to avoid monsters, there are level entrances and exits… 90% of the code is common between the two games.
The next feature I want to add is spine skeletal animation for the different characters: player, npcs and enemies. On a normal project, I would have simply change the parent class from Phaser.Physics.Arcade.Sprite to SpineGameObject. But I want the boilerplate to be versatile and be able to switch easily from different sprites without having to change the character class.
What I am thinking to do is to make the character class to extend directely from Phaser.GameObjects.Zone and simply attach them a sprite that would follow them everywhere. So if I want to use SpineGameObject instead of a Sprite, I can simply change the attached sprite, and that wouldn’t affect in any case the character behaviour.
Since it is a boilerplate, I want to start on solid ground and use an efficient solution for such an important thing, so it will be interesting for other people to use that boilerplate. But I don’t know Phaser enough to know if this is the most efficent solution. Phaser might already deal with such an issue. So do you think it is the solution I should use or is there a better one?
Thanks a lot!