| help + bits 
 
	 
	
		| Author | Message |   
		| Velocity 
 
  
 
 
 | 
			
				|  Posted: Thu Dec 08, 2011 9:53 am    Post subject: help + bits |  |   
				| 
 |  
				| How do i make it so that if Keydown = (KEY_BACKSPACE) then it goes back to the last page? |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Sponsor Sponsor
 
  
   |  |   
		|  |   
		| smool 
 
  
 
 
 | 
			
				|  Posted: Thu Dec 08, 2011 10:05 am    Post subject: RE:help + bits |  |   
				| 
 |  
				| what do you mean by last page?? |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Insectoid 
 
  
 
 
 | 
			
				|  Posted: Thu Dec 08, 2011 10:28 am    Post subject: RE:help + bits |  |   
				| 
 |  
				| Say you're in a main menu. You click on 'options'. This launches the 'options' procedure inside the 'main menu' procedure. When you hit backspace (or click 'Main Menu' or 'Back' or w/e), the procedure exits. Because the procedure was running inside the main menu procedure, it will just return to the main menu. |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Velocity 
 
  
 
 
 | 
			
				|  Posted: Thu Dec 08, 2011 10:30 am    Post subject: RE:help + bits |  |   
				| 
 |  
				| so like for example i have alot of procedures and i click the button that takes me to the procedure after i click a button its supposed to take me back to the last procedure that i ran... so for example here is the program im working on: 
 [syntax="turing"]
 
 import GUI
 var PicID : int
 var x : int := 700
 var y : int := 700
 PicID := Pic.FileNew ("ball02.jpg")
 Pic.Draw (PicID, x, y, picCopy)
 procedure TheGame
 setscreen ("graphics:700;700, nobuttonbar")
 %---------------------------
 %Player Co-ords            %
 var x1, y1, x2, y2 : int   %
 x1 := 250                  %
 y1 := 25                   %
 x2 := 350                  %
 y2 := 50                   %
 %---------------------------
 
 %---------------------------
 %Ball Co-ords              %
 var ballx, bally : int     %
 ballx := 250               %
 bally := 200               %
 %---------------------------
 
 %----------------------------------------
 %Game Basics                            %
 var lives : int := 3                    %
 var score : int := 0                    %
 var timePlaying : int := Time.Elapsed   %
 %----------------------------------------
 
 var arrowKeys : array char of boolean
 
 loop
 Input.KeyDown (arrowKeys)
 
 if arrowKeys (KEY_RIGHT_ARROW) then
 x1 += 5
 x2 += 5
 end if
 if arrowKeys (KEY_LEFT_ARROW) then
 x2 -= 5
 x1 -= 5
 end if
 
 drawfillbox (x1, y1, x2, y2, red)
 delay (10)
 cls
 drawfillbox (250, 650, 350, 675, 101)
 drawfillbox (0, 350, 1050, 355, 51)
 drawfilloval (ballx, bally, 15, 15, 48)
 if arrowKeys (KEY_ESC) then
 cls
 exit
 end if
 end loop
 
 if x1 > 925 then
 x1 -= 50
 elsif x2 < 25 then
 x2 += 50
 end if
 View.UpdateArea (0, 0, maxx, maxy)
 end TheGame
 
 %For tomorrow fix this up
 
 procedure Options
 
 end Options
 
 % procedure TheTitleScreen
 %     var game_Button : int := GUI.CreateButton (300, 300, 0, "Click To Play!", TheGame)
 %     var optionMenu_Button : int := GUI.CreateButton (300, 200, 0, "Options Menu", Options)
 %   %  var instructions_Button : int := GUI.CreateButton (300, 100, 0, "Learn How To Play", )
 % end TheTitleScreen
 
 procedure Instructions
 
 colorback (16)
 color (48)
 cls
 drawfillbox (0, 0, maxx, maxy, 51)
 locate (4, 1)
 put "The objective of the game is..."
 locate (7, 1)
 color (58)
 put "to destroy all of the blocks on your side of the screen (bottom)"
 locate (10, 1)
 color (73)
 put "Before the computer destroys all of his blocks on his side of the screen (top)"
 locate (13, 1)
 color (81)
 put "You will use the 'Left' and 'Right' Arrow keys to move left and right"
 locate (16, 1)
 color (96)
 put "Good Luck and go smash some blocks!"
 end Instructions
 procedure TheTitleScreen
 var game_Button : int := GUI.CreateButton (300, 300, 0, "Click To Play!", TheGame)
 var optionMenu_Button : int := GUI.CreateButton (300, 200, 0, "Options Menu", Options)
 var instructions_Button : int := GUI.CreateButton (300, 100, 0, "Learn How To Play", Instructions)
 delay (500)
 end TheTitleScreen
 
 var a : string (1)
 
 loop
 cls ()
 loop
 TheTitleScreen
 var game_Button : int := GUI.CreateButton (300, 300, 0, "Click To Play!", TheGame)
 var optionMenu_Button : int := GUI.CreateButton (300, 200, 0, "Options Menu", Options)
 var instructions_Button : int := GUI.CreateButtonFull (300, 100, 0, "Learn How To Play", Instructions, 0, '^D', true)
 exit when GUI.ProcessEvent
 end loop
 loop
 a := chr (10)
 exit when a = chr (10)
 end loop
 end loop
 
 [/syntax
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Velocity 
 
  
 
 
 | 
			
				|  Posted: Thu Dec 08, 2011 10:31 am    Post subject: RE:help + bits |  |   
				| 
 |  
				| @ insectoid, yea, how do i do that? |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Insectoid 
 
  
 
 
 | 
			
				|  Posted: Thu Dec 08, 2011 10:40 am    Post subject: RE:help + bits |  |   
				| 
 |  
				| You don't. It's something that just works out. Look at this code: 
 
 	  | code: |  	  | 
proc options
 var back : char := "n"
 loop
 get back
 exit when back = "y" %We don't 'go back'. We just quit.
 end loop
 end options
 
 proc main_menu
 if (options_clicked) then
 options() %Since we call it from here, main_menu will resume as soon as options finishes.
 end if
 end main_menu
 
 | 
 
 Dunno if the syntax is exactly right, but it should get the point across.
 |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Velocity 
 
  
 
 
 | 
			
				|  Posted: Thu Dec 08, 2011 4:58 pm    Post subject: RE:help + bits |  |   
				| 
 |  
				| oooooh wow thanks bro. Wow im so stupid lol, i see it now thanks  |  
				|  |  |   
		|  |  |  
	  
		|  |   
		| Aange10 
 
  
 
 
 |  |   
		|  |  |  
	  
		|  |   
		| Sponsor Sponsor
 
  
   |  |   
		|  |   
		|  |  
 |