
-----------------------------------
- IzAk -
Wed Feb 28, 2007 12:09 pm

A Main Menu Problem
-----------------------------------
Hey there, I'm having trouble with a program im making and the problem is this... i want an opening screen, like one youd use to select a difficulty in a game. although i dont need the selections option, i would like help on setting up an opening screen. Thank You!

-----------------------------------
BigBear
Fri Feb 08, 2008 12:21 pm

Re: A Main Menu Problem
-----------------------------------
To make a menu to select the dfficulty level you can do many things. First just get input from the user getch(ans) then if t is equal to "1" then run ask for another input then if that input (ans2) = "1" elsif ans2 = "2" then change difficulty to whatever. Then immediately run your game.

If you declare a variable for the difficulty like 
var difficulty : string := "Easy"
then have your main menu with things like Play, Options, How to Play, Quit etc then in option have a inut to change difficulty 1, 2, or 3 if that input = "1" then difficulty = "Easy"
elsif input = "2" then  difficulty = Hard"
elsif input = "3" then difficulty = "Impossible"
end if

Then where you run your game have an if statement like this

if difficulty = "Easy" then depending on your game something like delay1 = "20"
elsif difficulty = "Hard" then delay1 = "10"
elsif difficulty = "Impossible" then delay1 = 0
end if

then in your loop have:  delay(delay1)

-----------------------------------
Euphoracle
Fri Feb 08, 2008 2:57 pm

RE:A Main Menu Problem
-----------------------------------
I find it easier to use multipliers for difficulty in simple games where you're only modifying numbers to achieve the difficulty (eg, hit points, accuracy, ammo, time limit, etc)

-----------------------------------
Nick
Fri Feb 08, 2008 3:29 pm

RE:A Main Menu Problem
-----------------------------------
if that input = "1" then difficulty = "Easy"
elsif input = "2" then difficulty = Hard"
elsif input = "3" then difficulty = "Impossible"
end if

Then where you run your game have an if statement like this

if difficulty = "Easy" then depending on your game something like delay1 = "20"
elsif difficulty = "Hard" then delay1 = "10"
elsif difficulty = "Impossible" then delay1 = 0
end if

is the same as

if input = "1" then
    delay1 = 20
elsif input = "2" then
    delay1 = 10
elsif input = "3" then
    delay1 = 0
end if

%%OR

delay1 := 30 - strint(input)*10

-----------------------------------
BigBear
Fri Feb 08, 2008 3:34 pm

Re: A Main Menu Problem
-----------------------------------
Yes that is much better coding but what if the input is not right before the main program like if you have to hange it in options then go back to main menu before selecting play.
