Extending existing classes can be very powerful. In this tutorial learn the basics of how to extend a Sprite in Phaser 3.
William Clarkson, over at PhaserGames, writes: "Sometimes just adding a sprite into a game is enough. Other times it is very useful to extend a sprite.
Why? Being able to do this will let us get super organized. That allows us to build games faster and better. We can make complex classes that extend Phaser game objects such as sprite, text or images. Most importantly we can reuse the code!
In my experience using classes allows us to do more by writing less code. If well written, the class can be transferred from one game to another without changing the code in the class.
Extending existing classes can be very powerful. I’m going to show you the basics in this post of how to extend a sprite in Phaser 3."
The first book on the creation of HTML5 cross platform games using Phaser 3 and other free software.
- By Emanuele Feronato
- 155 Pages
- 28 Source Code Examples
- Build a complete game from start to finish
- Cross Platform
- Scaling for devices