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: A Developer’s Guide 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.