I'm making a game for class and I need help with a menu.
Author |
Message |
xboxdude_6262
|
Posted: Fri Jun 12, 2015 10:30 pm Post subject: I'm making a game for class and I need help with a menu. |
|
|
OK so Im trying to create a game but Im having trouble when it comes to making a menu. I want who ever is playing the game to be able to return back to the menu once they complete the task one of the menu options. they must go through all 4 options to find a secret word. I don't know how to make it return to the menu.
This is the code i have so far:
Turing: |
var name : array 1 .. 1 of string
var answer : string
var input : string
Draw.FillBox (0, 0, maxx, maxy, black)
colourback (black)
Text.Colour (12)
put "Welcome to Dragons Maze! Do you dare to play?"
get answer
if answer = "no" or answer = "No" then
quit
end if
for i : 1 .. 1
if answer = "yes" or answer = "Yes" then
put "Enter yout name!"
get name (i )
end if
end for
cls
var answerr : string
put "Welcome to Dragons Maze! ", name (1), " are You ready for the challenge?"
get answerr
if answerr = "no" or answerr = "No" then
quit
end if
if answerr = "yes" or answerr = "Yes" then
cls
for i : 1 .. 1
put "You wake up... Darkness fills the room. You ask yourself where you are but its impossible to tell without light. You hear a voice call your name."
put "Press any key to continue"
var tmp : char := getchar
cls
put name (i ), "!"
delay (2000)
put "Welcome!"
delay (2000)
put "You are one of our new test subject here at the Facility of Attainment."
delay (4000)
put "You will preform many tests for us."
delay (3000)
put "You " ..
delay (1000)
put "will " ..
delay (1000)
put "comply..."
delay (2000)
put "Resistance " ..
delay (1000)
put "is " ..
delay (1000)
put "futile."
delay (2000)
put "Just to lighten the mode a bit..."
delay (2000)
put "you may call us Anonymous."
delay (2000)
put "Lets get started shall we?"
delay (2000)
put "Press any key to continue"
var tmpp : char := getchar
cls
put "Loading" ..
delay (500)
put "." ..
delay (500)
put "." ..
delay (500)
put "."
delay (500)
cls
put "Loading" ..
delay (500)
put "." ..
delay (500)
put "." ..
delay (500)
put "."
delay (500)
cls
put "Loading complete, Welcome ", name (i ), "!"
put "Press any key to continue"
var tmppp : char := getchar
cls
var intfont : int
intfont := Font.New ("Times New Roman:120")
Font.Draw ("L", 50, 170, intfont, 12)
delay (500)
Font.Draw ("E", 150, 170, intfont, 12)
delay (500)
Font.Draw ("V", 250, 170, intfont, 12)
delay (500)
Font.Draw ("E", 350, 170, intfont, 12)
delay (500)
Font.Draw ("L", 450, 170, intfont, 12)
delay (500)
Font.Draw ("1", 550, 170, intfont, 12)
delay (2000)
Font.Draw ("L", 50, 170, intfont, black)
delay (500)
Font.Draw ("E", 150, 170, intfont, black)
delay (500)
Font.Draw ("V", 250, 170, intfont, black)
delay (500)
Font.Draw ("E", 350, 170, intfont, black)
delay (500)
Font.Draw ("L", 450, 170, intfont, black)
delay (500)
Font.Draw ("1", 550, 170, intfont, black)
delay (1000)
cls
put "The lights turn on, The room is all white. To the left and right of you there are doors. Four to be exact. Then theres one down the hall that appears to be locked."
delay (4000)
put "Press any key to continue"
var tmpppp : char := getchar
cls
loop
put "You must complete the challenges within all four doors.At the end of each you will be given 1 letter. If you choose door 1 your letter is the first letter of the word. If you choose door three the letter is the third letter in the word."
put "Once youve collected all 4 letters it will spell a word choose Enter Code to type it in which will then open the 5th and final door. Choose a door!"
put " "
put "1-labratory"
put "2-Dungeon"
put "3-Cafateria"
put "4-Office"
put "5-Dragond Nest"
put "6-Enter Code"
var user_input_menu : int
get user_input_menu
if user_input_menu = 1 then
put "You enter the labratory. Its full of chemicals and computers. You see a note on the floor."
put "It says to get the letter you must a magazine, turn it to pg 12 and put it on the test table. Then you must turn of all the lights. your letter will then be revealed."
put "Press any key to continue"
var tmppppp : char := getchar
cls
%there will be some more code but its here that i want to be able to return to the menu
end if
end loop
end for
end if
|
|
|
|
|
|
|
Sponsor Sponsor
|
|
|
TokenHerbz
|
Posted: Sat Jun 27, 2015 4:30 am Post subject: RE:I\'m making a game for class and I need help with a menu. |
|
|
Your menu is in that loop, so if you wanted to cycle code there the easiest thing to do is use another loop and exit when you are done in it, using a flag so you avoid it again.
its the absolutely worst way to go about it tho, but it'll work for you.
ex:: post under your last comment.
code: |
loop %%keep you in to solve said problem
var ans : string := ""
put "SOLVE ME"
get ans
exit when ans = "ans"
end loop
|
just use a global var to avoid re-entering completed feats. |
|
|
|
|
|
|
|