One class Sprite has :
public Graphics2D myColor(Graphics x){
Graphics2D p= (Graphics2D)x;
p.setColor(Color.RED;
return p;
}
Board Class has:
public void paint(Graphics g) {
super.paint(g);
bg = new ImageIcon("Trees!.png").getImage();
Graphics2D gfx= (Graphics2D)g;
g.drawImage(bg, 0,0,this);
gfx.setColor(Color.BLUE);
Rectangle r = new Rectangle(sp.getX()-20, sp.getY()-55,70,20);
g.drawString(sp.getMTag(), sp.getX()-20, sp.getY()-10);
sp.myColor(g).fillRect(sp.getX()-20, sp.getY()-55,sp.returnHealth() ,10);
gfx.draw(r);
g2d.dispose();
}
Why are the two seperate rectangles the same color???
sp.myColor(g).fillRect(sp.getX()-20, sp.getY()-55,sp.returnHealth() ,10);
gfx.draw(r);