New to Java

I figured it out! Thanks :DD

Now I have the game engine (funny calling this an engine) set up, and I just need to write the actual game.

Thanks! If I have any more questions I will post them here.

The best one can do when itching to write a game is read!

Good literature will give you and understanding of java that is very useful when writing games, I would recommend Head First: Java, that’s for the fundamental stuff within the language, like tr try catch statement and what it does.

When wanting to read more about game programming, developing games in Java by David Brackeen is good, it teaches you to write small things like threadpools and screen managers that can later be used to make a game.

//Kurten

This will probably be over your head, but you can use Swing to make a text area that looks like the console and then you have full control over it (clearing, scrolling, etc.).

I have seen several tutorials on swing, but I just don’t know enough about the language yet to know how to use that. Thanks, though!

Another issue I have is in my method names; they are all yellow-underlined and the reason is stated as “This method has a constructor name” but when I change any of them to a constructor, they don’t work. Any ideas as to why?

EDIT - Never mind, figured it out.

Here’s the code of the game so far -

Game.java

package source;

public class Game {

	public static boolean running = true;
	public static int loc = 1;
	
	public static void main(String[] args) {
		while (running) {
			LocationIdentifier.LocationIdentifier();
			InputHandler.InputHandler();
		}
	}
}

LocationIdentifier.java

package source;

import locations.MainMenu;

public class LocationIdentifier extends Game {
	public static void LocationIdentifier() { // YELLOW-UNDERLINED

		if (loc == 1) {
			MainMenu.MainMenu();
		}
	}
}

InputHandler.java

package source;

import java.util.Scanner;

public class InputHandler extends Game {
	public static void InputHandler() { // YELLOW-UNDERLINED
		Scanner rawInput = new Scanner(System.in);
		String input = rawInput.nextLine();

		if (input.equals("exit")) {
			System.out.println("Thanks for playing, now exiting...");
			running = false;
		}
		InputRedirector.InputRedirector(input);
	}
}

MainMenu.java

package locations;

import source.Game;

public class MainMenu extends Game {

	public static void MainMenu() { // YELLOW-UNDERLINED
		System.out.println("-Main Menu");
		System.out.println("-play -instructions -exit");
	}

	public static void MainMenuInput(String input) {
		if (input.equals("play")) {
			loc = 2;
		}
		
		if (input.equals("instructions")) {
			MainMenu.Instructions();
		}
	}
	
	public static void Instructions() {
		System.out.println("-Welcome to *name*, an adventure game where you can level up, find treasure, and explore.");
	}
}

InputRedirector.java

package source;

import locations.MainMenu;

public class InputRedirector extends Game {
	public static void InputRedirector(String input) { // YELLOW-UNDERLINED

		if (!running) {
			loc = 0;
		}

		if (loc == 1) {
			MainMenu.MainMenuInput(input);
		}
		
		if (loc == 2) {
			
		}
		
	}
}

I put it into multiple classes for my own sanity haha.