import java.awt.Color; import java.awt.Graphics; public class Block extends SimObject{ //Overview: Block is a SimObject that no MobileSimObject can walk pass. // Most Blocks are not destroyable. protected Color color; public Block(){ destroyable = false; hp = 3; color = new Color(160,100,100); } public Block(boolean d, int h){ destroyable = d; hp = h; color = new Color(160,100,100); } public Block(boolean d, int h, Color c){ destroyable = d; hp = h; color = c; } public Color getColor(){ return color; } public void drawImage(Graphics g, int x, int y, int w, int h){ g.setColor(getColor()); g.fillRect(x,y,w-1,h-1); } public void executeTurn() throws RuntimeException{ super.executeTurn(); if(hp<=0){ synchronized(getGrid()){ die(); } } } }