Computer Science Canada A Main Menu Problem |
Author: | - IzAk - [ Wed Feb 28, 2007 12:09 pm ] |
Post subject: | 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! |
Author: | BigBear [ Fri Feb 08, 2008 12:21 pm ] |
Post subject: | 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) |
Author: | Euphoracle [ Fri Feb 08, 2008 2:57 pm ] |
Post subject: | 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) |
Author: | Nick [ Fri Feb 08, 2008 3:29 pm ] | ||
Post subject: | RE:A Main Menu Problem | ||
Quote: 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
|
Author: | BigBear [ Fri Feb 08, 2008 3:34 pm ] |
Post subject: | 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. |