/* * Superclass of all objects in game. */ public class GameObject { protected double locationX, locationY; // Location of object (top-left corner of bounding box) protected double speedX, speedY; // Speed of object protected double sizeX, sizeY; // Size of object protected int degrees; // Angle of object. 0 is vertical. public GameObject() { } public GameObject(double locationX, double locationY, double speedX, double speedY, double sizeX, double sizeY) { this.locationX = locationX; this.locationY = locationY; this.speedX = speedX; this.speedY = speedY; this.sizeX = sizeX; this.sizeY = sizeY; } public String toString() { StringBuffer buf = new StringBuffer(100); buf.append("Location: (" + locationX + "," + locationY + ")"); buf.append(" Speed: (" + speedX + "," + speedY + ")"); buf.append(" Size: (" + sizeX + "," + sizeY + ")"); return buf.toString(); } public void setLocationX(double locationX) { this.locationX = locationX; } public double getLocationX() { return locationX; } public void setLocationY(double locationY) { this.locationY = locationY; } public double getLocationY() { return locationY; } public void setSizeY(double sizeY) { this.sizeY = sizeY; } public double getSizeY() { return sizeY; } public void setSpeedX(double speedX) { this.speedX = speedX; } public double getSpeedX() { return speedX; } public void setSizeX(double sizeX) { this.sizeX = sizeX; } public double getSizeX() { return sizeX; } public void setSpeedY(double speedY) { this.speedY = speedY; } public double getSpeedY() { return speedY; } }