Hi guys,
trying to set up a powerup selection where if the number is within a certain range a powerup type is given. I have this at the moment:
the very last powerup for shield how do I get it so that the number should be "greater or equal to 5 but less or equal to 7"?
powerupSpawn ++; if (powerupSpawn > 800){ int powerupSelection = Greenfoot.getRandomNumber(10); if (powerupSelection >= 8){ addObject(new HealthPowerup(),850,Greenfoot.getRandomNumber(300)); powerupSpawn = 0; } if (powerupSelection <= 4){ addObject(new WeaponPowerup(),850,Greenfoot.getRandomNumber(300)); powerupSpawn = 0; } if (powerupSelection >= 5){ addObject(new ShieldPowerup(),850,Greenfoot.getRandomNumber(300)); powerupSpawn = 0; } }