This site requires JavaScript, please enable it in your browser!
Greenfoot back
Ruben_Lathuy
Ruben_Lathuy wrote ...

2015/5/28

Setting Color in Greenfoot

Ruben_Lathuy Ruben_Lathuy

2015/5/28

#
I am trying to create a simple game where a space shit shoots asteroids moving along the screen. In trying to set the counter so that it is actually visible, I am getting an error to do with the Color.WHITE and I'm assuming its the same for Color.BLACK. The error says "cannot find symbol - variable Color" Any ideas? Here is my whole code for the counter section: public class Counter extends Actor { private int totalCount = 0; public Counter() { setImage(new GreenfootImage("0", 20, Color.WHITE, Color.BLACK)); } public void bumpCount(int amount) { totalCount += amount; setImage(new GreenfootImage("" + totalCount, 20, Color.WHITE, Color.Black)); } public void act() { // Add your action code here. } }
davmac davmac

2015/5/28

#
Did you import the Color class?
1
import java.awt.Color;
You need to login to post a reply.