Hi im trying to add the same object 5 times whit different image, but im stuck. this is the code i have, and its not working :-/
any help will be appreciated
private GreenfootImageshields = {new GreenfootImage("shield1.gif"),new GreenfootImage("shield2.gif"),
new GreenfootImage("shield3.gif"),new GreenfootImage("shield4.gif"),
new GreenfootImage("shield5.gif")};
/**
* Constructor for objects of class ForestWorld.
*
*/
public ForestWorld()
{
// Create a new world with 600x400 cells with a cell size of 1x1 pixels.
super(600, 400, 1);
populateWorld();
}
public void populateWorld()
{
int i = 0;
while(i < shields.length)
{
Shield shield = new Shield(shields + ".gif");
addObject(shield, Greenfoot.getRandomNumber(500),
Greenfoot.getRandomNumber(300));
}
}

