import java.awt.Graphics; import java.awt.Color; public class Dash extends Item{ //Overview: Dash is a permanent Item. When a UserTank dashes, // it moves 5 blocks at once. public Dash(){ super("Dash"); permanent = true; } public void action(SimObject so){ Tank t = (Tank)so; for(int i=0;i<5;i++){ t.moveDir(t.orient); t.delay(50); } } public void drawImage(Graphics g,int x, int y, int w, int h){ //draw the frame g.setColor(Color.black); g.fillRect(x+1,y+1,w-4,h-4); g.setColor(Color.yellow); g.fillRect(x+3,y+3,w-8,h-8); //draw the actual image g.setColor(new Color(180,180,255)); g.fillRect(x+w/8,y+3*h/8,w/4,h/4); g.setColor(new Color(120,120,255)); g.fillRect(x+2*w/8,y+3*h/8,w/4,h/4); g.setColor(new Color(70,70,255)); g.fillRect(x+3*w/8,y+3*h/8,w/4,h/4); g.setColor(Color.blue); g.fillRect(x+4*w/8,y+3*h/8,w/4,h/4); g.setColor(Color.black); g.fillRect(x+5*w/8,y+h/2-1,w/4-1,2); } }