Bringing the spaceship to life

First, we need to add a bit more functionality to our GameObject class. We do so in GameObject because bullets and asteroids share a surprising amount of similarities with a spaceship.

We need a bunch of getters and setters to get and set the rotation rate, traveling angle, and facing angle. Add the following methods to the GameObject class:

public void setRotationRate(float rotationRate) { this.rotationRate = rotationRate; } public float getTravellingAngle() { return travellingAngle; } public void setTravellingAngle(float travellingAngle) { this.travellingAngle = travellingAngle; } public float getFacingAngle() { return facingAngle; } public void setFacingAngle(float facingAngle) { this.facingAngle = facingAngle; ...

Get Android: Game Programming now with O’Reilly online learning.

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