© Graeme Stuart 2017

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

4. Drawing a Spaceship

Graeme Stuart

(1)Market Harborough, Leicestershire, UK

Okay, let’s get a bit more serious and start work on our game elements. The spaceship in both the classic and modern Asteroids games is based on a simple isosceles triangle. In this chapter, we’ll draw the spaceship and develop the design using quadratic curves to customize our ship.

We want our ship to approximate to a circle with a given radius because later we will use “circle to circle” collision detection. So, we’re interested in locating points on the edge of a circle. Using angles and distances (polar coordinates) is the obvious way to specify ...

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.