Reputation: 163
I am working on a very simple text adventure game in Java and I am just wondering how to get it into a window so it will look more like an actual game. Like could I have someone click on an icon and it pop up with this simple game? Thank you for your help and I am sorry if I waste your time!
//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();
}
}
Upvotes: 3
Views: 1254
Reputation: 6518
Just Migrate your code to NetBeans IDE.Create a Window and may be a text box and whatever you want and finally pack it to an executable jar.
Upvotes: 1