Posted: Mon May 31, 2010 12:10 am Post subject: Implementing a Main Menu for options
I was wondering how to make a main menu that would call several game programs (all in java) using the RTP IDE most likely.
I am trying to make a sort of small arcade type thing with a few simple games: pong, some dodging thing, a very simple pacman, maybe a bullet hell (probably not), I don't really know.
Of course I can't ask my teacher anything because she has been gone for most of this year, and the rest of this year.
Supply teacher doesn't know anything about compsci so yeah.
I don't necessarily have to use RTP but my teacher is 100% likely to run our code in it when she is going to mark.
Also if anyone has beforehand tips on making the AI for the ghosts in pacman (if i even put them in) then it will be much appreciated!
Thanks in advance, and advice/suggestions are appreciated!
Sponsor Sponsor
Tony
Posted: Mon May 31, 2010 12:24 am Post subject: Re: Implementing a Main Menu for options
revangrey @ Mon May 31, 2010 12:10 am wrote:
Also if anyone has beforehand tips on making the AI for the ghosts in pacman (if i even put them in) then it will be much appreciated!
Posted: Mon May 31, 2010 3:20 pm Post subject: RE:Implementing a Main Menu for options
We would need more information, especially how encapsulated your games are. Are they all in one method? Are they in multiple static methods? Or are they fully OO? Also we would need to know how complicated a menu do you want. Do you want something console based like this:
Java:
import java.io.*;
public class Main
{
public static void main(String[] args)
{
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int number = -1;
while(number != 0)
{
System.out.println("Arcade Menu");
System.out.println("-----------");
System.out.println("Enter Number To Play:");
System.out.println("0: Exit");
System.out.println("1: First Game");
System.out.println("2: Second Game");
try
{
number = Integer.parseInt(br.readLine());
}
catch(Exception e)
{
number = -1;
}
switch(number)
{
case 0:
{
System.out.println("Quitting...");
}
break;
case 1:
{
// First Game goes here
System.out.println("Win!!!");
}
break;
case 2:
{
// Second Game goes here and so on
System.out.println("Win Again!!!");
}
break;
default:
{
System.out.println("Invalid Input, try again");
}
break;
}
System.out.println();
}
}
}
Or do you want a full graphical menu like in my Geometry Wars Clone(you can download the source and look at the Menu and MenuItem classes)?