Computer Science Canada

Help With A "GoTo" Type Command

Author:  Rasta Fella [ Sun Jan 15, 2006 7:25 pm ]
Post subject:  Help With A "GoTo" Type Command

Ok, I am making a game w/ main menu, level select etc. Now the problem is lets say you go to "level 6"..there is a button on the bottom of the menu "main menu" then is there a procedure to call that will take you to let's say the top ofyour source code?? I checked in the "Turing Reference" and "Turing Walkthough@compsci.ca". Any help is appreciated.

Author:  cool dude [ Sun Jan 15, 2006 7:32 pm ]
Post subject: 

u mean like a goto command in visual basic? i strongly suggest not to use that because it will complicate manners later on such as if u make another line you'll have to keep changing the line number. wat i do suggest is making watever code u want to go back to as a procedure and then just call it whenever u want. another thing u could do is just make a loop of the whole program so when its done it goes back to the beginning of the program. i'm not sure if thats wat u were looking.

Author:  iker [ Sun Jan 15, 2006 8:31 pm ]
Post subject: 

try making a bunch of procedures
for example
code:

proc mainmenu
loop
%code for mainmenu
% have a boolean for level selecting screen
if 'clicked' then
levelselectscreen := true
exit
end if
..
end loop
end mainmenu

proc levelselect
if levelselectscreen = true then
%code for level select
%if level6 is clicked then make a boolean..
if 'clicked' then
level6 := true
end if
end if
end level select

proc game
loop
if level1 = true then
%level 1
elsif level2 = true then
%level 2
..
exit when dead = true
..
end loop
end game

loop
mainmenu
levelselect
game
end loop

Author:  Rasta Fella [ Mon Jan 16, 2006 3:53 pm ]
Post subject: 

Thanks Iker and cool dude. Ok, im making a proc command. And I call that command everytime I need too.

Author:  Rasta Fella [ Mon Jan 16, 2006 4:19 pm ]
Post subject: 

But...just for general knowledge..Is there a GoTo type command???

Author:  iker [ Mon Jan 16, 2006 6:31 pm ]
Post subject: 

Rasta Fella wrote:
But...just for general knowledge..Is there a GoTo type command???

The answer is no. Turing does not support a 'GoTo' type command, just procedures, processes and functions(?) that can be called upon


: