import java.awt.Color; import java.awt.Graphics; public class HorizonCombinationBlock extends Block{ //Overview: A HorizonCombinationBlock is a changable color block. // When the hp changes its value, the block changes its look. public HorizonCombinationBlock(){ super(true,2,Color.blue); } public void drawImage(Graphics g, int x, int y, int w, int h){ g.setColor(Color.red); g.fillRect(x,y,w-1,h-1); g.setColor(Color.blue); g.fillRect(x+1,y+1,w-2,h/2-2); switch(hp){ case 0: g.setColor(Color.blue); break; case 1: g.setColor(Color.green); g.fillRect(x,y,w-1,h-1); g.setColor(getColor()); g.fillRect(x+1,y+1,w-3,h/3-3); g.setColor(getColor()); g.fillRect(x+1,y+h/3+h/3,w-3,h/3-3); break; case 2: g.setColor(getColor()); g.fillRect(x+1,y+1,w/2-2,h/2-2); // g.fillRect(x+w/2,y+h/2,w/2-2,h/2-2); break; } } }