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

2011/12/13

Declaring a color variable

carterfootball carterfootball

2011/12/13

#
is there any way that I can declare a variable for a color so that I can change the color after the amount of a counter reaches a certain point.
darkmist255 darkmist255

2011/12/13

#
Yup. Just say something like
String color = "purple";
int timeUntilChange;

act()
{
  if(timeUntilChange > 0)
  {
  timeUntilChange = timeUntilChange - 1;
  }
  if(timeUntilChange <= 0)
  {
  changeColor();
  }
}
You need to login to post a reply.