public class Star extends Particle { private float theta; private float rate; /** * Parameterized constructor expects values for position, velocity, acceleration, * and particle size (in that order). */ public Star (Vector2D position, Vector2D velocity, Vector2D acceleration, float pWidth, float pHeight) { super(position, velocity, acceleration, pWidth, pHeight); theta = 0; rate = random(-0.1, 0.1); } /** * Method for rendering the star: */ public void render () { smooth(); fill(260, 80, 20, 180); //Spinning version: pushMatrix(); translate(position.getX(), position.getY()); rotate(theta); beginShape(); vertex(-pWidth/2, 0); vertex(-pWidth/8, pWidth/8); vertex(0, pWidth/2); vertex(pWidth/8, pWidth/8); vertex(pWidth/2, 0); vertex(pWidth/8, -pWidth/8); vertex(0, -pWidth/2); vertex(-pWidth/8, -pWidth/8); endShape(CLOSE); theta += rate; popMatrix(); } }