I tried putting the counter at 5, 100, 500 and it gives me the same results. What am I doing wrong?
import greenfoot.*;
/**
* Write a description of class Home here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class Fire extends Actor
{
private GreenfootImage image1;
private GreenfootImage image2;
private int counter;
private int actCounter;
/**
* Act - do whatever the Home wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public Fire()
{
image1 = new GreenfootImage("fire-small.png");
image2 = new GreenfootImage("fire-big.png");
setImage(image1);
}
public void act()
{
switchImage();
counter++;
if (counter == 3)
{
counter = 0;
switchImage();
}
}
public void switchImage()
{
if (getImage() == image1 )
{
setImage(image2);
}
else
{
setImage(image1);
} // Add your action code here.
}
}