© Graeme Stuart 2017

Graeme Stuart, Introducing JavaScript Game Development , https://doi.org/10.1007/978-1-4842-3252-1_9

9. Inheritance

Graeme Stuart

(1)Market Harborough, Leicestershire, UK

In this chapter we’ll begin to build our final version of the Asteroids game. We’ll need objects to describe asteroids and our ship and we will eventually need objects for our projectiles too, which the ship will use to destroy asteroids. In this case, the objects will all share some common features, and this makes them good candidates for inheritance. Inheritance is an important concept in object-oriented software engineering because it allows for potentially complex logic to be expressed once and used across multiple object types. We’ll learn this in the ...

Get Introducing JavaScript Game Development : Build a 2D Game from the Ground Up now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.