我在课堂上做的这个项目需要帮助。这就是我所拥有的!
public class Game {
public static void main(String[] args) {
// TODO Auto-generated method stub
int Naruto = 0;
int DragonBallZ = 1;
int Batman = 0;
int Freedom = 0;
int righthand = 1;
int lefthand = 1;
if (Naruto == 0) {
if (lefthand == 0) {
System.out.println("The command 0 has been used...");
System.out.println("Processing...");
System.out.println("Accessing Game Server...");
System.out.println("Success!");
System.out.println("You have been given the 'Kunai'");
} else if (righthand == 1) {
System.out.println("The command 1 has been used...");
System.out.println("Processing...");
System.out.println("Accessing Game Server...");
System.out.println("Success!");
System.out.println("You have been given the 'Shurikan'");
}
if (DragonBallZ == 1) {
if (lefthand == 0) {
System.out.println("The command 2 has been used...");
System.out.println("Processing...");
System.out.println("Accessing Game Server...");
System.out.println("Success!");
System.out.println("You have been given the 'Kaioken' Ability");
} else if (righthand == 1) {
System.out.println("The command 3 has been used...");
System.out.println("Processing...");
System.out.println("Accessing Game Server...");
System.out.println("Success!");
System.out.println("You have been given the 'Super Saiyan 4' Ability");
}
if (Batman == 2) {
if (lefthand == 0) {
System.out.println("The command 4 has been used...");
System.out.println("Processing...");
System.out.println("Accessing Game Server...");
System.out.println("Success!");
System.out.println(" You have been given the 'Batarang' ");
} else if (righthand == 1) {
System.out.println("The command 5 has been used...");
System.out.println("Processing...");
System.out.println("Accessing Game Server...");
System.out.println("Success!");
System.out.println(" You have been given the 'Keen Eyes' Ability");
}
if (Freedom == 3) {
if (lefthand == 0) {
System.out.println("The command 6 has been used...");
System.out.println("Processing...");
System.out.println("Accessing Game Server...");
System.out.println("Success!");
System.out.println(" You have been given the 'Rope' ");
} else if (righthand == 1) {
System.out.println("The command 7 has been used...");
System.out.println("Processing...");
System.out.println("Accessing Game Server...");
System.out.println("Success!");
System.out.println(" You have been given the 'Knife' ");
}
}
}
}
}
}
}
因此,如果有人可以帮助我,我正在尝试制作 4 款游戏,每款游戏都有 2 种武器。当我运行程序时,我需要该游戏的 1 武器。我不断得到该武器编号的所有游戏的结果。因此,如果有人可以提供帮助,那就太棒了!谢谢!
- 编辑 - 我也在使用 Eclipse 来编写 java 程序!