Thursday 7 February 2019

"Bomb Run" for Homeputerium BASIC 10-Liners Programming Contest 2019



Got another entry pretty much squared away for the Homeputerium Basic 10-Liners contest.  It's called "Bomb Run" and it is based on some graphics ideas used by Robert Sieg a few years back in his game "SG6 Bomber." Robert is a prolific contributor to the MC-10 community, especially when it comes to programs that push the graphics of the MC-10 to the max. I think his game was meant as an experiment with the obscure (and neglected) semi-graphics 6 video mode of the MC-10. This mode gives you a screen of 64 by 48 pixels in two colours kind of like the lowres graphics of the Sinclair ZX81. However, unlike the ZX81, no text is available, although I have created a very chunky 3-pixel by 3 pixel character and number set for use in this mode. Here is a pic of a game I ported from the NEC PC6001 (it also uses an MC6847 graphics chip), which uses these characters:


Can you read the instructions?
Tom        Home
Wall        Yum
Key         Rock
1 Make  3 Load   Play
2 Cont   4 Save    Spc

The Motorola MC6847 is actually capable of putting 4 colours on the screen in this mode (as it does on the PC6001), but because of the simplicity/cost minimization of the MC-10 it is not wired up to fully utilize all the features of the chip. However, there is an alternate colour set to red and blue. You can see it here in a duelling cannons game I made:


The other color is orange, so on the whole this set is much brighter on screen. I switch to this alternate colour set when bombs hit their target to provide a flash effect. Robert does something similar in his original game. He switches right out of the mode and back into the 64 X 32 Semigraphics 3 (SG3) mode, which also has ASCII characters available.  It makes for some pretty freaky flashing. Here's a vid of Robert's game:


As you will see, I used much small targets than him. I found his targets just a little too easy to hit, even with the plane bobbing around. But I really liked his plane graphic and the scrolling concept. I programmed the game from scratch to make sure it fit 10 lines. I drew the graphics using a simple Semigraphics 6 graphic editor program that I created. It prints its screen to a text file which I can then just cut and paste from as needed into my program editor (Notepad).

Here is the program breakdown:

Initialize variables and input level of play
0 CLS:CLEAR1000:DIMT,P,B,X,YA$,B$,S,H,Q,R,LV:B=480:O$="":M=16384:Q=32:INPUT"LEVEL (1-3)";LV:LV=7-LV:IFLV<1ORLV>6THEN0
Build the long strings for the scrolling terrain. Objects are stored in string directly within the MID$ statements, which simply randomly pick the 3 characters needed for each type of object to be inserted after every 32 black block characters ("€"). 
1 CLS4:MI=MI+1:SOUND1,1:?@267,"MISSION"MI;:A$="":B$="":FORX=1TO7:FORY=1TOQ:A$=A$+"€":B$=B$+"€":NEXT:T=RND(9)*3:S=0:H=0:P=42
2 A$=A$+MID$("€€€€ƒ‚¤ƒ€ƒ‚€€‚€€ªª‚‚€ƒ€‹€",T,3):B$=B$+MID$("€€¶¢­½¨„¶‹™¹ˆŸµŠ»»¿½­¨¯ˆ‘—ƒ",T,3):NEXT:CLS0:POKE49151,28
Main loop. Just cycles through 210 of the two strings printed at the bottom of the screen using the MID$ function to display 31 characters from the current location. This creates the illusion of motion.  Bomb positions are calculated and printed to, or an empty string is printed at the bottom of the screen, until the space key is pressed to release a new bomb. Line 4 is where space key input is processed.
3 FORT=1TO210:?@B,"€";:?@P,"€‚„‚€€€";:?@P+Q,"€¿¿‹€";:?@P+64,"€€¸€€€";:IFRND(20)=1THENR=2-RND(3):P=P+R*-(P+R>36ANDP+R<50)
4 ?@448,MID$(A$,T,31);:?@480,MID$(B$,T,31);:B=B-(B<480)*Q:?@B,O$;:FORZ=1TOLV*2:NEXT:IFINKEY$=" "THEN?@B,"€";:O$="Â":B=P+99
Boundary checks for falling bombs are made here (if falling) and jumps are made if a hit occurs or if the bottom is reached, the bomb is "turned off" by swtching it character to a null string "".
5 IFB>448THENO$="":IFB<480THENS=S+1:Y=PEEK(M+B+Q):IFY>128ANDY<192THEN?@B-2,"ÄÿÿÿÈ";:?@B-2+Q,"ÄÿÿÿÈ";:POKE49151,68:S=S-1:GOTO9
End of the main loop.  After it, checks are made to determine if you have missed too many times, or whether you should loop back and start the run over.  If you miss too much the end routine is initiated, which displays your score, high score, and restart prompt.
6 NEXT:ON-(S<LVANDH<6)GOTO3:ON-(H=6)GOTO1:HS=SC*-(SC>HS)+HS*-(HS>=SC):CLS0:POKE49151,0:CLS:PRINT@44,"bomb run"
7 ?:?TAB(9)"BY JIM GERRIE":?:?TAB(8)"AND ROBERT SIEG":?:?:?:?"SCORE"SC"& LV"7-LV:?"HIGH"HS:?:?
8 INPUT"PLAY AGAIN (Y/N)";M$:MI=0:SC=0:ON-(LEFT$(M$,1)<>"N")GOTO1:END
Subroutine for hits on targets.
9 X=B-448:A$=LEFT$(A$,T+X-3)+"€€€€€"+MID$(A$,T+X+3):B$=LEFT$(B$,T+X-3)+"€ÇÍ€"+MID$(B$,T+X+3):SC=SC+1:H=H+1:POKE49151,28:GOTO6
Instructions as REM statements.
10 REM GRAPHIC CONCEPT FROM
11 REM "SG6 BOMBER" BY ROBERT
12 REM SIEG.
13 REM PRESS SPACE TO DROP
14 REM BOMBS. LV 1 = 6 MISSES
15 REM AND MISSION OVER.
16 REM LV 3 = 4 MISSES AND
17 REM MISSION OVER. YOU MUST
18 REM COMPLETE A MISSION
19 REM TO BE SENT ON ANOTHER.

The game can be played in the MC-10 Javscript emulator hosted at my faculty website at Cape Breton University: http://faculty.cbu.ca/jgerrie/MC10/JG_MC10.html
Just click on the "- Select Cassette -" menu and choose "BOMBRUN". Then type RUN and hit the <ENTER> key.

No comments:

Post a Comment