Rear Gunner XL – Part 4 – Movement

So far we’ve setup the variables we need, and drawn our sights and the enemy into the screen.  We still can’t really play the game though, as we need to have some way of moving around,  This is handled in lines 90 to 140:

; 90 IF INKEY$=“5” THEN LET B=B-1
; 100 IF INKEY$=“8” THEN LET B=B+1
; 110 IF INKEY$=“7” THEN LET A=A-1
; 120 IF INKEY$=“6” THEN LET A=A+1
; 130 IF INKEY$=“0” THEN GOTO 150
; 140 GOTO 50

Continue reading

Advertisements

Pick a key, any key…

Finally!  The mythical keyboard post!!  Sorry it’s taken so long, but SokoBAArn was taking it’s time (along with a large & overgrown garden back in the real world). Anyway, we’re here now, woohoo!!

Back in the depths of time I did a short piece on how to detect if a key is pressed, which used the following code:

WAITFORKEY:
ld a, 0
in a, (254)
cpl
and %00011111
jp z, WAITFORKEY

That’s actually the basis for all keyboard reading, and as complicated as it gets, just that we were doing a particular and simple case – testing for any key being pressed.

Continue reading

Pause on tap

There’s two things which I don’t like about that colours program – firstly that the screen wasn’t clear before we coloured it, and secondly that it immediately returns to BASIC afterwards, and so you lose the bottom two rows of the screen before you even had a chance to see them.

We’ll get onto the screen shortly (I promise!), but first, that other issue… Continue reading