/** * MooseSprite.java * @author Jeff Ondich, 5 November 2010 * * The abstract parent class for Sprites in the Playground example. */ import java.awt.*; public class MooseSprite extends Sprite { private Color mooseColor; private int mooseWidth; public MooseSprite(int x, int y, int vx, int vy, Color color) { super(x, y, vx, vy); this.mooseColor = color; this.mooseWidth = 50; } /** * Required implementation of Sprite's abstract draw method. */ public void draw(Graphics g) { Color previousColor = g.getColor(); g.setColor(this.mooseColor); g.fillRect(this.positionX, this.positionY, this.mooseWidth, this.mooseWidth); g.setColor(previousColor); } }