Now that we've got most of the basics of the game working, let's take a break and tidy up the presentation of the game a bit.
First let's add an intro menu:
MENU: EVENTS > INTRO MENU
EVENT INTROMENU
WAITKEY
BORDER 0 ; black border
COLOUR 68 ; green text on black
CLS ; clear the screen
LET CONTROL = 99
WHILE CONTROL >= 99
PRINTMODE 1
AT 4 7
PRINT "RETURN TO ARCADIA"
PRINTMODE 0
AT 8 10
PRINT "1. KEYBOARD"
AT 10 10
PRINT "2. KEMPSTON"
AT 12 10
PRINT "3. SINCLAIR"
AT 14 10
PRINT "4. REDEFINE"
LET CONTROL = 99
WHILE CONTROL = 99
IF KEY OPTION1
LET CONTROL = 0
ENDIF
IF KEY OPTION2
LET CONTROL = 1
ENDIF
IF KEY OPTION3
LET CONTROL = 2
ENDIF
IF KEY OPTION4
CLS
WHILE KEY OPTION4
ENDWHILE
AT 7 12
PRINT "PRESS KEY FOR:"
AT 9 12
PRINT "LEFT"
DEFINEKEY LEFT ; the key pressed will be the new LEFT key
AT 11 12
PRINT "RIGHT"
DEFINEKEY RIGHT ; the key pressed will be the new RIGHT key
AT 13 12
PRINT "THRUST"
DEFINEKEY UP ; the key pressed will be the new THRUST key
AT 15 12
PRINT "FIRE"
DEFINEKEY FIRE1 ; the key pressed will be the new FIRE key
AT 17 12
PRINT "PAUSE"
DEFINEKEY FIRE3 ; this will be the PAUSE key
LET CONTROL = 100
CLS
ENDIF
ENDWHILE
ENDWHILE
CLS
Next, we'll tidy up the Game Initialisation event:
MENU: EVENTS > Game Initialisation:
EVENT GAMEINIT
LET L = 1 ; Level (starts at 1)
LET LIVES = 3
AT 0 14
DISPLAY LIVES
AT 0 1
SHOWSCORE
AT 0 25
SHOWHIGH
Now lets add a 'Get Ready message to the screen every time the player starts (including after being killed if they still have lives left:
EVENT RESTARTSCREEN
LET S = 0 ; initialise the sprite counter
AT 0 1 ; position the cursor Line 0 Column 1
SHOWSCORE ; display the score
AT 10 12 ; Cursor at L10 C2
REPEAT 10 ; do this 10 times
READ A ; read next item into A
CHR A ; Display A
DELAY 5 ; short wait
ENDREPEAT ; all items displayed?
DELAY 100 ; longer wait
DATA 'G' 'E' 'T' ' ' 'R' 'E' 'A' 'D' 'Y' '!'
Next, the Kill Player event:
MENU: EVENTS > KILL PLAYER
EVENT KILLPLAYER
SUBTRACT 1 FROM LIVES ; reduce number of lives remaining
AT 0 16 ; update the lives in the score bar
DISPLAY LIVES
CLW ; clear the play area
And finally, for now, the Lost Game event:
MENU: EVENTS > LOST GAME
EVENT LOSTGAME
AT 10 12 ; Cursor at L10 C2
REPEAT 10 ; do this 10 times
READ A ; read next item into A
CHR A ; Display A
DELAY 5 ; short wait
ENDREPEAT ; all items displayed?
DELAY 100 ; longer wait
DATA 'G' 'A' 'M' 'E' ' ' 'O' 'V' 'E' 'R' '!'
And for a touch of visual flourish, we ll add a starfield to the play area, add this line in to your Main Loop 1 event:
STAR DOWN ; vertical star field
I'm also going to select a new font.
Now lets test it:
And there you go, if you have reached this point you should have a small, but fully functioning, vertical shoot 'em up! My version is currently using just under 13Kb of memory, so we have plenty left to play with. At some point we're going to want to add some sound, maybe add some powerups, but next I want to improve the Alien sprite so that it points in the right direction that it is travelling.
Comments