So, in my game I have balloons that fly from right to left onscreen, and a scoreboard that keeps track of the amount of times the act method has occurred and displays it onscreen. If I wanted to make it so when the score hit 2000, the frequency of enemies would increase, how would I go about doing it? The spawner is a method in the world class with the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 | /** * The method used to spit out balloons every so often. */ public void spawnBalloons() { if (Greenfoot.getRandomNumber( 900 ) <= 10 ) addObject( new RedBalloon(), 790 , Greenfoot.getRandomNumber( 200 )); if (Greenfoot.getRandomNumber( 300 ) <= 10 ) addObject( new BlueBalloon(), 790 , Greenfoot.getRandomNumber( 200 )); if (Greenfoot.getRandomNumber( 600 ) <= 10 ) addObject( new YellowBalloon(), 790 , Greenfoot.getRandomNumber( 200 )); } |