为了在 10 个 ProjectilesDestroyed 后增加等级,我设置了 switch case,其中 10 个 projectiles Destroyed 后的第 1 级显示第 2 级,但从第 2 级开始,每 2 个 projectilesDestroyed 增加,并且级别增加到超过 10,我应该如何使其相差10以增加水平。这就是我实施的方式
if (++_projectilesDestroyed > 5)
{
_projectilesDestroyed = 0;
// for(level=1; level<12; level++)
switch(level)
{
case 1:
_projectilesDestroyed = 10;
System.out.println("case 1");
break;
case 2:
_projectilesDestroyed = 20;
System.out.println("case 2");
break;
case 3:
_projectilesDestroyed = 30;
System.out.println("case 3");
break;
case 4:
_projectilesDestroyed = 40;
System.out.println("case 4");
break;
case 5:
_projectilesDestroyed = 50;
break;
case 6:
_projectilesDestroyed = 60;
break;
case 7:
_projectilesDestroyed = 70;
break;
case 8:
_projectilesDestroyed = 80;
break;
case 9:
_projectilesDestroyed = 90;
break;
case 10:
_projectilesDestroyed = 100;
System.out.println("case 10");
break;
default: break;
}
addLevel();
addLevel() 方法。
public void addLevel() {
level = level + 1;
showLevel(level);
}
即使我添加了休息;在第 2 级的所有情况下,它会为每 2 个 projectilesDestroyed 更新,但我希望它达到 10 时。