I would really appreciate any help!
addObject(new Zombie(), 100, 100); addObject(new Zombie(), 100, 100); //same as for (int i=0; i<2; i++) addObject(new Zombie(), 100, 100);
Zombie zombie = new Zombie(); for (int i=0; i<2; i++) addObject(zombie, 100, 100);
public class Zombie extends Actor
{
public void act()
{
move(2);
if(Greenfoot.getRandomNumber (20) == 1)
{
setRotation(180);
setImage(new GreenfootImage("Zombie Right.png"));
}
}
}turn(180);
turn(180);
private int direction = 1;
public void act()
{
move(direction*2);
if (Greenfoot.getRandomNumber(20)==0) direction *= -1;
}private int direction = 1;
public void act()
{
move(direction*2);
if (Greenfoot.getRandomNumber(20)==0) direction *= -1;
}