I am trying to create images in a world. I want to use a list, add an item from the list, then remove the item so it can't be added again. I am trying to use .remove.
import greenfoot.*; // (World, Actor, GreenfootImage, Greenfoot and MouseInfo)
public class MyBoard extends World
{
private String[] Images = {"Copper","Lead","Gold", "Carbon","Platinum"};
public MyBoard()
{
super(600, 400, 1);
//set up images
for(int i=0; i < 5; i++)
{
int x = Greenfoot.getRandomNumber(Images.length); //count images in array,
Cards card = new Cards(Images[x] + ".jpg");//add the image
addObject(card, 90 + i*125,110);
Images.remove(x);//then remove element from the array so it can't be placed again
}
}
}
