I have created a multiple choice answer shooter game, where the answer actors spawn in a random row but they occasionally spawn on top of each other concealing an answer underneath. I have read various discussions on this but can't work out how to make it work in my code. I have included the code below. Any help would be grateful.
public void addObjectsToWorld() {
getWorld().addObject(new Answer(folderPath + "/correct.png", true), Greenfoot.getRandomNumber(getWorld().getWidth()), 150);
getWorld().addObject(new Answer(folderPath + "/false1.png", false), Greenfoot.getRandomNumber(getWorld().getWidth()), 150);
getWorld().addObject(new Answer(folderPath + "/false2.png", false), Greenfoot.getRandomNumber(getWorld().getWidth()), 150);
getWorld().addObject(new Question(folderPath + "/question.png"),getWorld().getWidth() - getWorld().getWidth()+ 450, 70);
}
