i loaded 8 images to make it look moving but it's too fast can you help me add a delay between the images...i tried using Greenfoot.delay() but that makes the whole world and other actors slow down too
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
/**
* Write a description of class E_Bringer here.
*
* @author (your name)
* @version (a version number or a date)
*/
public class E_Bringer extends Actor
{
GreenfootImage walkRight = new GreenfootImage;
GreenfootImage walkLeft = new GreenfootImage;
public int animationCount=0;
public E_Bringer()
{
initAnimationSprites();
}
/**
* Act - do whatever the E_Bringer wants to do. This method is called whenever
* the 'Act' or 'Run' button gets pressed in the environment.
*/
public void act()
{
runLeft();
move(-1);
checkEdge();
// Add your action code here.
}
public void initAnimationSprites(){
for(int i = 0; i < 8; i++){
walkLeft = new GreenfootImage("Bringer-of-Death_Walk_"+ (i+1) +".png");
//System.out.println(walkRight);
}
for(int i = 0; i < 8; i++){
walkRight = new GreenfootImage("Bringer-of-Death_Walk_"+ (i+1) +".png");
walkRight.mirrorHorizontally();
}
}
public void runRight(){
setImage(walkRight);
}
public void runLeft(){
setImage(walkLeft);
}
public void checkEdge(){
World w = getWorld();
if(isAtEdge()){
w.removeObject(this);
}
}
}