我正在研究一个非常简单的Java文本冒险游戏,我只是想知道如何将它放到一个窗口中,所以它看起来更像是一个真实的游戏。就像我可以让某人点击一个图标,它弹出这个简单的游戏?感谢您的帮助,如果我浪费您的时间,我很抱歉!
//bored programming
import java.util.*;
public class test {
public static void main(String[] args){
Scanner input = new Scanner (System.in);
String x = "hey";
System.out.println("Welcome to adventure game!");
System.out.println();
System.out.println("Which way do you want to go?: ");
x = input.nextLine();
if (x.equals ("west")){
System.out.println("You walk towards the forest.");
west();
}
else if (x.equals("east"))
System.out.println("You go East!");
else if (x.equals("south"))
System.out.println("You go South!");
else if (x.equals("north"))
System.out.println("You go North!");
else
System.out.println("You cannot go that way!!");
}
public static void west(){
Scanner input = new Scanner (System.in);
System.out.println("Which way shall you go?");
String x = input.nextLine();
}
}