Hi, I need help. I create actor called Vosa and I want spawn 15x Vosa on random position and after 5 seconds I wanna removed them and spawend another 15x Vosa, can you help me pls ?
Hi, I need help. I create actor called Vosa and I want spawn 15x Vosa on random position and after 5 seconds I wanna removed them and spawend another 15x Vosa, can you help me pls ?
First create a method to spawn one at any random location. Show method here to continue.
public class MyWorld extends greenfoot.World
{
public void pridejVosu() // pridej = add
{
Vosa v = new Vosa();
int x = Greenfoot.getRandomNumber(this.getWidth());
int y = Greenfoot.getRandomNumber(this.getHeight());
this.addObject(v, x, y);
}
public MyWorld()
{
super(1177, 768, 1);
for(int i=0; i<15; i++)
{
this.pridejVosu();
}
}