import java.awt.Color; import java.awt.Graphics2D; import java.awt.Rectangle; import java.awt.Shape; /* * Represents bullets in the game. */ public class Bullet extends GameObject { public Bullet(double locationX, double locationY, double speedX, double speedY) { super(locationX, locationY, speedX, speedY, 5, 5); } public void draw(Graphics2D g2) { int maxw = (int) sizeX, maxh = (int) sizeY; int x = (int) locationX, y = (int) locationY; int degrees = 0; g2.setColor(Color.white); Rectangle body = new Rectangle(x, y, maxw, maxh); // The line below will rotate the shape some angle in degrees Shape shape = Asteroids.rotateShape(x+maxw/2,y+maxh/2, body, degrees); g2.fill(shape); } }