GAMES MASTER TUTORIAL, part 1 With Dr Andy Wright David has asked meto write something about Games Master. I decided that I should write a very simple game, so that users who do not own Games Master yet have something to play with. Users who DO have the program can load the file "maze.g" using the Games Master Editor and look at the listing, edit the sprites, sounds movements, etc. For the rest of you I give the program listing below, so that you can get some idea whatis going on. The listing at theend of this article is in Games Master Control Language (GMCL) which is a simple language that is converted into machine code by the Games Master Editor. Anything that is not posible in GMCL can be handled by BASIC subroutines calledfrom the GMCL program. (There are none inthis program.) You are free to sell or give away programs you have created with Games Master, but not the Games Master Editor itself. The listing is as you would see it on the screen or a printer, apart from some extracomments I'veadded in brackets. GMCL programs are split into Modules, to simplify the job of the Editor and compiler. When a program is run, Module 1 is executed first,followed by any modules it jumps to. In this example, modules 2,3 and 4 are executednext. After that, the game will keep going without any other instructions. The SAM handles everything itself, moving and bouncing all the sprites, until specified collisions occur. If you have specified a modulenumber in a collision table (not shown here) then the collision will cause that particular module to be activated. The later modules in the listing are activated in this way. Sprites can call particular Modules when defined keys are pressed, allowing them to drop bombs, fire guns, or whatever. In this example, you can restart the game at Module 1 or Module 2 by pressing particular keys - these were selected with the EDIT KEYS and EDIT SPRITE PROPERTIES options in the Games Master Edit or (not shown). The locations of the maze walls were set up interactively using the EDIT BLOCKS Option, but they could have been included in a Module instead - allowing e.g. random positions. Also the BLOCK SET command could be used to select another set of pre-definedblocks, FILLed with a different pattern if you wish. BFILL can use any sprite as a fill pattern. The coordinate system used runs left to right from 0 to 127, top to bottom from 191 to 0. This allows sprites to be placed off-screen at e.g.200,88 and gradually appear in view. (Not in this example, though.) The sprites were designed using the graphics editor, although when you are as completely lackingin artistic ability as I am, it is temping to GRAB graphics from somebody else's SCREEN files instead! If you have stereosound available, the sounds made by theenemy "eye" sprites should appear to follow them round the screen. *** MODULE 1 *** REM clear sprites SCLEAR CLS LOCATE 14,150 TEXT "USE CURSORS OR A JOYSTICK" LOCATE 14,130 TEXT " TOUCH ALL 4 CORNERS" LOCATE 14,110 TEXT " SPACE BARRESTARTS GAME" LOCATE 14,90 TEXT "RETURN KEYRESTARTS LEVEL" VIEW FOR N=1,1000,1 NEXT N PAUSE 0 REM Set level LET L=3 JPMOD 2 *** MODULE 2 *** REM Make all sprites inactive SCLEAR REM Select palette 1 CLS PAL 1 BORDER 4 REM Fill wall blocks with REM sprite 5 FOR B=2,18,1 BFILL B,5 NEXT B REM Fill 3 corner blocks FOR C=19,21,1 BFILL C,6 NEXT C REM Fill start block BFILL 22,7 JPMOD 3 *** MODULE 3 *** REM Place player(sprite 1) at REM 0,191 on sprite plane 4. PLACE 1,0,190,4 REM Place L enemy sprites, with REM random speeds and at random REM points in their animation REM sequences. FOR N=1,L,1 PLACE 3,120,40,4 SPEED 0,RND(7)-3,RND(7)-3 ANIM 0,2,RND(7)+1 NEXT N REM Print Level LOCATE 90,185 PAPER 4 TEXT L JPMOD 4 *** MODULE 4 *** VIEW PAPER 0 REM Corners visited=0 LET S=0 LET A=0 LET B=0 LET C=0 REM Game now starts and keeps REM going by itself! (The Module below is activated at any time the player collides with the start block at the top right. If all the other corner shave been touched, the level i.e. the number of enemy sprites - is increased and the game starts again.) *** MODULE 6 *** REM player vs start block REM Do nothing if hasn't touched REM score blocks yet. IF S<3:RETURN REM else playerwins REM Sound 10 inmiddle of stereo REM field. SOUNDX 10,63 REM Short delay FOR N=1,10000,1 NEXT N CLS REM Increase level and restart LET L=L+1 JPMOD 2 (The Module below is activated when the player touches an enemy sprite. The skull sprite cannot move, so you cannot do anything till you press SPACE or RETURN to restart the game.) *** MODULE 8 *** REM player vs eye SOUND 6 REM Turn sprite1 (player) into REM sprite 2 (skull) at same REM position TRANSFORM 1,2,0,0 (The following Modules handle collisions with the maze corners.) *** MODULE 10 *** REM player vs score block A REM signal "scored" and make a REM sound on first collision IF A=1:RETURN LET A=1 LET S=S+1 SOUND 2 REM erase corner BACK 4,123,191,1 *** MODULE 11 *** REM player vs score block B REM signal "scored" and make a REM sound on first collision IF B=1:RETURN LET B=1 LET S=S+1 SOUND 2 BACK 4,0,9,1 *** MODULE 12 *** REM player vs score block C REM signal "scored" and make a REM sound on first collision IF C=1:RETURN LET C=1 LET S=S+1 Good Luck from Andy Wright.