© 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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.