At the first, sorry for my bad english.
I have the following scenario:
Every 5 sec. spawns a red,blue or yellow balloon on a random position in the world. After the 5 Secs, the balloon stays between 10 and 30 second and disappears.
I know that I have to work with Boolean and getRandomNumber, but don kno how.
Here is my idea..
BalloonR = Red
BalloonY = Yellow
BalloonB = Blue
Red class....
public class Spawner extends Actor
{
int spawner;
public boolean szenario0=false;
public boolean szenario1=false;
public boolean szenario2=false;
public void act()
{
int Greenfoot.getRandomNumber(3){
if (0){
szenario0;
}
if (1){
szenario1;
}
if (2){
szenario2;
}
if (!szenario1){
spawner++;
if (spawner >=300 ){
getWorld().addObject(new BalloonR(), Greenfoot.getRandomNumber(getWorld().getWidth()),
Greenfoot.getRandomNumber(getWorld().getHeight()));
spawner=0;
}
}
}
}
int remove;
public void act()
{
remove++;
if (remove >= Greenfoot.getRandomNumber(300)+300){
getWorld().removeObject(this);
remove = 0;
}
}
