So i want to make a game that requires something (in my case a stone) spawns every five seconds or so (it should also spawn randomly in the map). Is there any possiblity of doing this??
Thanks in advance.


1 2 3 4 5 6 7 8 9 10 | private int stoneSpawn= 275 , stoneSpawnTimer=stoneSpawn; public void act() { if (--stoneSpawnTimer== 0 ) { stoneSpawnTimer=stoneSpawn; addObject( new Stone(), Greenfoot.getRandomNumber(getWidth()), Greenfoot.getRandomNumber(getHeight())); } } |
1 2 3 4 | public void act() { zufälligSteineErstellen(); } |