Slice

A 10-line TurboBASIC XL program for the Atari 8-bit computer
Written for 2014 NOMAM programming competition

Bill Kendrick, February 16, 2014

An entry for the NOMAM 2014 10-line TurboBASIC XL game competition.


Objective

Using a Touch Tablet (or alternatively, a pair of paddle controllers), move a blue block around the screen, trying to catch yellow blocks that appear at the bottom, and scroll towards the top.

When you catch a yellow block, you earn a point. (Note: you don't need to be touching it precisely.) If a block hits the top of the screen, you are penalized. Earned points are shown at the very top as a bar that grows from left to right. Penalties are shown just below that as a bar that grows from right to left.

When either bar is full — either you have earned 40 points, or allowed 40 blocks to hit the top of the screen — the game ends, and you are shown your final score.

Scoring

A perfect score would be 140. Other winning scores would vary between 101 and 139, depending on how many objects you missed.

Progression

The game has 10 waves. Each wave begins slowly, and gradually ramps up in speed, until things slow back down when the next wave begins. (The background color is different for each wave.) Each wave has an increasing chance of objects appearing at the bottom at any given moment. So in early levels, objects appear 'every once in a while', and in level 10, new ones appear almost constantly.


Development

Since I own an Atari Touch Tablet, and touchscreen cellphones and tablets are all the rage, I decided to try making a game that used it.

After whipping up code to let me draw pixels on the screen (in the correct positions) when I touched the tablet, I thought for a while about what kind of game to make. "Fruit Ninja" and its ilk have been popular, and though I've never played it (except for a few minutes with the Xbox Kinect version) and knew I could not simulate it in 10-lines of BASIC, it's more-or-less what my goal was.

In the end, the game is kind of similar to "Stampede" for the Atari 2600, in that you are penalized for letting objects get away from you. Less similarly, it's kind of like "Kaboom!".

Unlike my previous 3 games, this one was not difficult to squeeze into 10 lines of code. By squeezing things down a little, I was able to provide a scoring screen (that went beyond simply showing final score and wave; instead, I was able to break the scoring down).


Line-by-line Breakdown of the Source Code

Set-up

10 GRAPHICS 19:SC=DPEEK(88):Y=3:SZ=SC+30:SPD=3:IT=0:RAT=10:OK=1

Main loop

20 POKE SZ,0:POKE SZ+10,0:Q=Q+1:IF Q>=SPD THEN Q=0:MOVE SC+30,SC+20,220:OK=1:IT=(IT+1) MOD 10:IF IT=0 THEN SPD=SPD-1
30 PX=PADDLE(0):PY=PADDLE(1):IF PX<228 AND PY<228:X=INT(PX/6):Y=22-INT(PY/11):ENDIF :SZ=SC+Y*10+INT(X/4)
40 IF PEEK(SZ)+PEEK(SZ+10):V=15:PT=PT+1:COLOR 3:PLOT PT MOD 40,0:ENDIF :COLOR 3:PLOT X,Y
70 FOR XX=0 TO 9:IF PEEK(SC+20+XX):POKE SC+20+XX,0:BD=BD+1:COLOR 2:PLOT 39-(BD MOD 40),1:SOUND 0,100,12,8:ENDIF :NEXT XX
80 IF RAND(RAT)=0 AND OK:COLOR 1:PLOT RAND(30)+5,22:OK=0:ENDIF :IF SPD=0 THEN SPD=3:RAT=RAT-1:POKE 712,(10-RAT)*16:IF RAT<1 THEN RAT=1
90 SOUND 0,255-PT*6,10,V:V=V-1:IF V<0:V=0:ENDIF :IF BD>=40 OR PT>=40:GOTO 1000:ENDIF :GOTO 20

Sub-routine

1000 GRAPHICS 18:? #6;"hit +";PT:? #6;"miss -";BD:IF BD>=40:? #6;"loss -100":PT=PT-100:ELSE :? #6;"win +100":PT=PT+100:ENDIF
1010 ? #6;"total ";PT-BD:SOUND 0,0,0,0:PAUSE 600:RUN

Download


Bill Kendrick, 2014, nbs@sonic.net, New Breed Software
Other games I wrote for NOMAM 2014