Making and using a generic Enemy class in ES6.

Article by Richard Davey. Posted on 17th Feb 2016.   @phaser_

image

"This is my first tutorial. If it’s appreciated I will add more posts on different topics I think of while working on my Metroid remake. First up is how I decided code the enemies by creating a generic enemy class that extends Phaser.Sprite, and then add actual enemies as extensions of that class. This approach allows me to reuse code and to add new enemy types with limited effort focusing only on their uniqueness. I don’t want to clutter this page with full-length code from the game, but rather explain with stripped down and altered versions of the code. This is a tutorial focusing the topic in the tile, not on JavaScript (ES6/ES2015 or not) per se."

Read More