Looping game back to main menu
Author |
Message |
IamPillzbury
|
Posted: Sat Apr 18, 2015 2:56 pm Post subject: Looping game back to main menu |
|
|
What is it you are trying to achieve?
I'm making an interactive story for school
What is the problem you are having?
If the player chooses instructions, he/she will read through the information and will have to close the window and run it again to play the game. I want it so that once the instructions are done, the player can press a certain key and it will loop it back to the main menu
Describe what you have tried to solve this problem
I've tried to make a loop for the area dedicated for instructions but it doesn't really work
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Turing: |
% Mid-Term Project: Contagion
% By: Martin
% April 16,2015
%Variables
var strChoice : string
var strName : string
var strSkip : string
var strMenu : string
var blnRun : boolean
var font1 : int
var font2 : int
var font3 : int
var intMouseX : int
var intMouseY : int
var intMouseBut : int
var intX : int
%Initializing
blnRun := false
intX := 150
font1 := Font.New ("Ravie:12:italic")
font2 := Font.New ("Comic Sans MS:22")
font3 := Font.New ("Lucida Console:30")
proc TypewriterPrint (text : string)
for i : 1 .. length (text )
delay (20)
put text (i ) ..
end for
put ""
end TypewriterPrint
%Menu
var Drawing := Pic.FileNew ("Logo.bmp")
Pic.Draw (Drawing, 80, 300, picMerge)
Font.Draw ("An interactive story", 350, 300, font1, black)
if blnRun = false then
loop
Draw.FillBox (290, 190, 360, 230, white)
Font.Draw ("(P)lay", 300, 200, font2, brightred)
delay (10)
Draw.FillBox (290, 150, 360, 220, white)
Font.Draw ("(I)nstructions", 245, 150, font2, brightred)
var chars : array char of boolean
Input.KeyDown (chars )
%Play
if chars ('p') then
cls
loop
Font.Draw ("Loading world", 180, 250, font3, brightred)
Draw.FillBox (150, 150, 500, 200, blue)
Draw.FillBox (intX, 150, 500, 200, white)
delay (20)
intX := intX + 5
exit when intX > 500
end loop
cls
%Instructions
elsif chars ('i') then
cls
TypewriterPrint ("This game is decided based on your decisions.")
TypewriterPrint ("You can choose your decisions by pressing its respective letter on the keyboard.")
TypewriterPrint ("Instructions on how to input using mouse will be given during the game.")
put (" ")
TypewriterPrint ("Thanks for playing=D")
blnRun := true
end if
exit when chars ('p')
exit when chars ('i')
end loop
end if
|
Please specify what version of Turing you are using
4.1.1
P.S: First post on this site. no hate pls |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Insectoid
|
Posted: Sat Apr 18, 2015 3:40 pm Post subject: RE:Looping game back to main menu |
|
|
You should put the instructions into their own procedure. Inside your main menu, if the player clicks 'instructions', then call the instructions procedure. When the player exits the instructions, simply exit the main loop in your instructions procedure and the procedure will end, which will cause your main menu loop to automatically resume. |
|
|
|
|
|
IamPillzbury
|
Posted: Sat Apr 18, 2015 4:48 pm Post subject: Re: RE:Looping game back to main menu |
|
|
Insectoid @ Sat Apr 18, 2015 3:40 pm wrote: You should put the instructions into their own procedure. Inside your main menu, if the player clicks 'instructions', then call the instructions procedure. When the player exits the instructions, simply exit the main loop in your instructions procedure and the procedure will end, which will cause your main menu loop to automatically resume.
How would I do that if I may ask? My teacher has only taught us basics, looping and if statements |
|
|
|
|
|
Insectoid
|
Posted: Sat Apr 18, 2015 11:40 pm Post subject: RE:Looping game back to main menu |
|
|
There are plenty of tutorials covering procedures on this site. Have a look at The Turing Walkthrough or try the search button at the top of the page. |
|
|
|
|
|
|
|