我目前正在为自己玩的游戏开发一个小型应用程序,并且目前已经为该应用程序编写了代码,但是我不知道如何让扫描仪从仿真器获得输入。我将如何解决这个问题?
import java.util.Scanner;
public class MarrowGnawerCombo {
public static void main(String[] args) {
//take user input for number of times combo will be activated
Scanner Input = new Scanner(System.in);
System.out.println("Enter how many times you wish to tap Marrow-Gnawer:");
int NumOfTaps = Input.nextInt();
//take user input for number of how many rats you start with
System.out.println("Enter how many rat cards you currently control:");
double NumOfRats = Input.nextDouble();
Input.close();
//math for combo
for (int i = 0; i < NumOfTaps; i++) {
NumOfRats = NumOfRats--;
NumOfRats = NumOfRats * 2;
}
//print out results
System.out.println("After tapping Marrow-Gnawer " + NumOfTaps + " times, you will create " + NumOfRats + " 1/1 rat tokens.");
}
}
这里是所有人都需要的代码。