© Graeme Stuart 2017

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

7. Animating Asteroids

Graeme Stuart

(1)Market Harborough, Leicestershire, UK

In this chapter we’re going to introduce some critical structure into our code. The previous few chapters introduced the requirement to store data tied to our game elements. This chapter introduces the use of objects as a solution to the explosion in complexity this brings. Objects are a great solution because they enable data and code to be intimately connected.

Now that we can animate, we can start to build out the main parts of the game. We’ll start by getting some asteroids on the screen, floating about. Asteroids float in space, and they keep going ...

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.