Adding A Main Loop
All programs generally require a main loop. A main loop is defined by a start and end point within your program wherein your program pointer will loop. You can imagine your program pointer as an invisible arrow that points to each command in turn and executes the instruction, then moves to the next one.
When this pointer reaches the end of a main loop, it jumps back to the top of the loop to continue the cycle. Click the mouse pointer near the first line that reads REM * HERE * and delete this line using the text cursor. You can now replace this line by typing the following: HIDE MOUSE
Now press F4 to check your program. You should receive a ‘Compilation Successful’ prompt at the bottom of the screen.
Modify the rest of the code to look like this:
rem Initialise program
HIDE MOUSE
rem Main game loop
DO
rem End of game loop
LOOP
Now press F5 to run the program. If the run is successful, you will notice the mouse pointer has gone and the screen remains black.
Your program is now running in a main loop. You can return to the editor by pressing F12 or hitting the ESCAPE key and clicking the EXIT button.
Click Here To Load the completed entries directly into the Editor
SWARM-01.DBA.
Click Here For The Next Tutorial Creating A Backdrop.