1 of 7

Turing ISP help

Girls CPT

2 of 7

What will we cover?

  • How the main loop works
  • The general program flow for a game
  • Other useful syntax

3 of 7

What does the main loop do?

% the intro method is called here

loop

exit when GUI.ProcessEvent

end loop

% the goodbye method is called here

/* most methods are called inside other

methods instead of in the main program */

  • This loop ensures that the buttons you use in your game (the ones for the game and/or the ones that allow you to switch from screen to screen and call other methods) work.
  • This loop stops when the quit button is pressed (when GUI.Quit is called)

4 of 7

Program Flow

  • The game should start with a splash screen that runs an animation which should be called in the main program
  • On the intro page there should be a button that leads to another page on the intro page
  • Eventually players should be able to reach the main menu which should give a few options including a button allowing players to start the game and a button that allows the player to quit the game (same quit button that’s mentioned on the previous slide)

5 of 7

Useful Syntax

% creates a window (declared as a global variable)

var mainWin : int := Window.Open ("position:100;100,graphics:800;600")

% closes the window (used in the goodbye method)

Window.Close (mainWin)

Where the window appears on the monitor screen

Width of the window

Height of the window

6 of 7

Useful Syntax

% creates a button

var mainMenuButton : int := GUI.CreateButtonFull (150, 295, 150, "Main Menu", mainMenu, 50, '^m', true)

% hides the button

GUI.Hide (mainMenuButton)

Where the button appears on the window

Width of the button

Words that are written on the button

The method the button calls

Height of the button

Shortcut to use the button (in this case shift + m)

7 of 7

Useful Syntax

If one procedure calls a second procedure the code for the second procedure should be written above the first procedure ( because the program needs to know that the second procedure actually exists). If the second procedure calls the first one as well then you can use forward proc procedureName to tell the program that the procedure exists and it will no longer matter if the procedure is called in code that’s above it

forward proc method2

proc method1

% code

end method1

body method2

% code

end method2

Should be written before any code for methods