Hi, Friends
Is there a way to control the time between images in this class?
* @author mik
* @version 1.0
*/
public class AnimatedActor extends Actor
{
private GreenfootImage[] images;
private int currentImage = 0;
public AnimatedActor(String basename, String suffix, int noOfImages)
{
images = new GreenfootImage[noOfImages];
for(int i=0; i < noOfImages; i++) {
images[i] = new GreenfootImage(basename + i + suffix);
}
setImage(images[currentImage]);
}
/**
* Act - do whatever the AnimatedActor wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
currentImage = (currentImage + 1) % images.length;
setImage(images[currentImage]);
}
}

