Abstract
In this chapter we’ll finally implement user control of the ship. This is where all the hard work in setting up our objects will begin to pay off. At the end of this chapter you’ll be able to fly the ship gracefully around the canvas and even shoot projectiles from the nose of the ship. As with the Pac-Man example, we’ll need to add some properties to our ship class so we can use keyboard events to control the ship. The ship remains a mass floating in space, so we only want to use the Mass.prototype.push and Mass.prototype.twist methods to do the actual moving.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Rights and permissions
Copyright information
© 2017 Graeme Stuart
About this chapter
Cite this chapter
Stuart, G. (2017). Controlling the Ship. In: Introducing JavaScript Game Development . Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-3252-1_11
Download citation
DOI: https://doi.org/10.1007/978-1-4842-3252-1_11
Published:
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4842-3251-4
Online ISBN: 978-1-4842-3252-1
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books