June 2015
Intermediate to advanced
388 pages
7h 31m
English
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; ...Read now
Unlock full access