Hi all,
just trying out a switch statement, my question relates to the case element. How can the case use an operator like >= or <= ? As I'm trying to add different enemy patterns based on the random number selected. You can see my attempt below which work only with a =
if (selection == 1)
{
int enemySelection = Greenfoot.getRandomNumber(10);
switch (enemySelection )
{
case 1:
enemySelection = 6;
moveLeft();
break;
case 2:
enemySelection = 5;
moveLeftDown();
break;
}
enemyBoundary();
}
}