I'm trying to spawn an object every 500 points which i need help with on, as well as removing the object after 4 seconds.
Alot of the code below is more trial and error. If the score is at 500 i need the laser spawned, then after 4 seconds it gets removed, then after another 500 points(so now at 1000) id like another spawned and then removed after 4 seconds
1 2 3 4 5 6 7 8 9 10 11 | if (scoreV == 50 ) { if (getWorld().getObjects(Laser. class ).size() != 1 ) { getWorld().addObject( new Laser(),(Greenfoot.getRandomNumber( 1050 ) + 50 ), 215 ); if (timer == 0 ) { getWorld().removeObjects(getWorld().getObjects(Laser. class )); } } } |