Saturday 5 June 2021

Defender: 10-Liner Game for itchi.io Game Jam 2021


Working on a project for the Basic 10-Liner Contest being run on itch.io based on the image of the city from a APF Imagination Machine TS-1000 1970s game console:


My version is written in Micro Color Basic on my favourite 8-bit computer, and the first computer I ever owned, the TRS-80 Micro Color Computer 10 or MC-10.  Some call it the Poco because it is the little brother to the Tandy Color Computer.  It's a budget 8-bit micro along the lines of the Sinclair ZX-81.

The game can be played at my website using Mike Tinnes TRS-80 MC-10 Javascript emulator. Just select DEFENDER from the cassette menu, and the type RUN in the main screen and hit <Enter>. Type list to see some instructions listed at the end as REM statements.

Here is the Basic code for the game:

0 D(T)=RND(0):I(T)=RND(31):J(T)=0:IFRND(2)=1THEND(T)=-D(T):I(T)=I(T)+32

1 CLS0:?@320,"€€€€€€€€€€€—’€€€€€€€€€€““’€€€€€€€€€€€€óÿò€‘››€€€€€€£££“›";

2 ?"›š€€€€€€€€óóò€ûúþú•——€ÞÞÞÞÚ««¯›››š€þþþú€€óûûûòûÿýú———’ÞÞÞÞÚ««¯›››š";

3 ?"€þþûú€€ûûûûúûþþú››››ÞÞÞÞÚ««¯›››šóûþûú€®ûûÿüúûþÿÿ›š•—ßÜßÜß««®››žŸþ÷";

4 A=-SGN(PEEK(2)ANDNOTPEEK(16946))+SGN(PEEK(2)ANDNOTPEEK(16948))

5 B=-SGN(PEEK(2)ANDNOTPEEK(16952))+SGN(PEEK(2)ANDNOTPEEK(16947))

6 RESET(X,Y):X=X+A:X=X-(X<0)+(X>63):Y=Y+B:Y=Y-(Y<0)+(Y>19):SET(X,Y,5)

7 IFPOINT(I(T),J(T))=5THENSOUND1,1:S=S+1:GOTO0

8 T=RND(5):I(T)=I(T)+D(T):J(T)=J(T)+1:IFPOINT(I(T),J(T))>1THENH=H+1:GOTO

9 SET(I(T),J(T),0):?@508,H;:ON-(H<10)GOTO4:?"SCORE"S;:INPUT"enter";A:RUN

10 REM   1         2         3         4         5         6         7  

11 REM789012345678901234567890123456789012345678901234567890123456789012

12 REM DEFENDER BY JIM GERRIE

12 REM ASCII BASIC GAMER

13 REM 10-LINER CONTEST 2021

14 REM USE A W S AND Z TO

15 REM MOVE WHITE TARGETTING

16 REM CURSOR & PAINT MISSILE

17 REM TO STOP IT. CITY CAN

18 REM ONLY TAKE 10 HITS

You'll notice in line 8 the GOTO has no line number.  I'm taking advantage of the fact that if no line number is provided then Basic assumes line 0, which is the line I want it to go to.  This keeps me under the 72 character limit.

Lines 1-3 are the ASCII characters in strings for the city.  These characters are from the different block characters in the Motorola MC6847 character set, values 128-255.

Line 0 sets random starting points for the incoming missiles.

Lines 4-5 peek the keyboard input buffer so I can get continuous input in 8 directions using the AWSZ keys.  If you hold down two at a time, you can get diagonal motion.

Key Input:

    AW      W       WS

           \      |      /

          A     +    W

            /     |     \ 

    AZ        Z        SZ


Lines 6-9 move the targeting cursor and the missiles.  Line 9 also has the restart instructions for the end of the game.

Enjoy.

No comments:

Post a Comment