【发布时间】:2020-09-11 17:22:01
【问题描述】:
System.out.println(" ");
System.out.println("I knew something was up driving past that billboard.");
System.out.println(" ");
System.out.println("Something didn’t feel right.");
System.out.println(" ");
System.out.println(sName + " " + "Watch out there's a deer!!!");
System.out.println(" ");
System.out.println("1) Turn to the left ");//Three options to choose from.
System.out.println("2) Turn to the right ");
System.out.println("3) Continue driving forward ");
int iAnswer = 0;// Need to put this above so it'll work.
iAnswer = Integer.parseInt(System.console().readLine()); // Finding when we're getting there
if (iAnswer == 1) {
System.out.println("You skid to the left dramatically, and injure Keith badly.");
if (iAnswer == 2) {
System.out.println("Skid to the right fast avoiding the deer and crash the car into a tree damaging" + " " + sName + ".");
if (iAnswer == 3){
System.out.println("You hit the deer, and die of a fatal accident flipping the car and killing both your friends.");
}
}
}
例如,如果玩家选择 1 作为答案,导致 Keith 在车祸中受重伤,我想稍后将其用作玩家的劣势。我如何告诉 PC 从该答案开始遵循特定路径。如果他们选择了问题 3 导致所有角色都死亡,我将如何结束游戏。
【问题讨论】:
-
你已经得到了答案。您应该接受它,或者向作者解释为什么它不能解决您的问题。请记住,人们正在投入时间通过撰写答案来帮助您。
标签: repl.it