Moon Landing by RAX
About
10 Line BASIC Challenge
=======================
Category : PUR-80
TITLE : Moon Landing
PLATFORM : Oric Atmos
LANGUAGE : BASIC 1.1b
AUTHOR : RAX
VIDEO :
-------------------
Story:
Hello Commander. Your mission is to successfully land the LEM (Lunar Excursion Module)
Landing should be smooth and soft.
--------------------
CODE: 0PAPER0:INK7:TEXT:FORI=0TO15:READA:POKE#B908+I,A:NEXT:DEFFNR(X)=RND(1)*X:G=.1 1HIRES:Y=150:M=3:FORI=12TO230STEP6:R=FNR(14)-7:IFY+R<190ANDY+R>120THENY=Y+R 2CURSETI+6,Y,3:T=FNR(60)+35:CHART,1,1:CURSETI,Y,3:CHART,1,1:DRAW0,6,3 3FILL193-Y,2,255:CURSETFNR(239),FNR(110),1:NEXT:Y=5:X=FNR(220)+12:PRINT"LVL:"S 4POKE#26A,10:INK3:REPEAT:K=PEEK(#208):Y=Y+V:V=V+G:IFX+E>12ANDX+E<225THENX=X+E 5IFK=156THENV=V-.3-G:ELSEIFK=172THENE=E-FNR(1)ELSEIFK=188THENE=E+FNR(1) 6IFY<0THENY=0ELSE:CURSETQ,W,3:CHAR33,1,M:M=2:CURSETX,Y,3:CHAR33,1,M:Q=X:W=Y''' 7L=Y+8:O=POINT(X,L):P=POINT(X+2,L):L=POINT(X+5,L):Z=Y>115AND(OORPORL):UNTILZ'' 8G=G+0.03:CURSETX+7,Y,3:S=S+1:DATA0,12,22,47,30,12,30,51,,,48,62,60,56,32,32 9IFOANDPANDLANDV<2THENCHAR34,1,1:PING:WAIT200:GETA$:GOTO1ELSEEXPLODE RUN0PAPER0:INK7:TEXT:FORI=0TO15:READA:POKE#B908+I,A:NEXT:DEFFNR(X)=RND(1)*X:G=.1
PAPER0 - set paper black
INK7 - set ink white
FORI=0TO15:READA:POKE#B908+I,A:NEXT - change characters
DEFFNR(X)=RND(1)*X - define custon function R to generate random number
G=.1 - gravity = 0.1
=======================
1HIRES:Y=150:M=3:FORI=12TO230STEP6:R=FNR(14)-7:IFY+R<190ANDY+R>120THENY=Y+R
HIRES - switch to hires screen mode
Y=150 - y pos from where to start generating lunar ground
M=3 - mode to show char (sprite) 3 -hidden
FORI=12TO230STEP6 - repetition to generate the moon ground
R=FNR(14)-7 - use function to create random number from -7 to 7
IFY+R<190ANDY+R>120 THEN - ground limit check
Y=Y+R = new Y position
=======================
2CURSETI+6,Y,3:T=FNR(60)+35:CHART,1,1:CURSETI,Y,3:CHART,1,1:DRAW0,6,3
CURSET I+6,Y,3 - set x position + 6 and y position whit hidden mode
T=FNR(60)+35 - get random ascii char from the alternate charset table
CHAR T,1,1 - print chart T on screen from alternate charset table
CURSETI,Y,3 - set x position and y position whit hidden mode
CHAR T,1,1 - print chart T on screen from alternate charset table
DRAW0,6,3 - create line 0,6px in hidden mode
==============
3FILL193-Y,2,255:CURSETFNR(239),FNR(110),1:NEXT:Y=5:X=FNR(220)+12:PRINT"LVL:"S
FILL193-Y,2,255 - fill block 193-y px and 2 horisontal bites (2*6 px) whit inverse line
CURSETFNR(239),FNR(110),1 - create random star
NEXT
Y=5 - y position for player
X=FNR(220)+12 - random x position for player
PRINT"LVL:"S - print current level
====================
4POKE#26A,10:INK3:REPEAT:K=PEEK(#208):Y=Y+V:V=V+G:IFX+E>12ANDX+E<225THENX=X+E
POKE#26A,10 - hide command prompt and disable keyboard sound
INK3 - set yellow ink
REPEAT - start iteration
K=PEEK(#208) - read key
Y=Y+V - add vertical(V) velosity
V=V+G - increase the velosity with gravity
IFX+E>12ANDX+E<225THEN - if player x pos in limits (>12,225<) then
X=X+E add horisontal(E) velosity
====================
5IFK=156THENV=V-.3-G:ELSEIFK=172THENE=E-FNR(1)ELSEIFK=188THENE=E+FNR(1)
IFK=156 - if pressed key is "UP" then
V=V-.3-G - decrease vertial velosity
ELSE
IFK=172THEN - if pressed key is "LEFT"
E=E-FNR(1) - add a random negative horizontal force from interval (0-1)
ELSE
IFK=188THEN - if pressed key is "RIGHT"
E=E+FNR(1) - add a random positive horizontal force from interval (0-1)
======================
6IFY<0THENY=0ELSE:CURSETQ,W,3:CHAR33,1,M:M=2:CURSETX,Y,3:CHAR33,1,M:Q=X:W=Y'''
IFY<0THEN - if player Y pos < 0 then
Y=0
ELSE
: - nothing
CURSETQ,W,3 - set cursor in old player postition
CHAR33,1,M - print player in mode M (3- hidden; 2 - XOR)
M=2 - set mode to 2
CURSETX,Y,3 - set current in player postion
CHAR33,1,M - print player in mode M (3- hidden; 2 - XOR)
Q=X - Q - old X pos
W=Y - W - old Y pos
====================
7L=Y+8:O=POINT(X,L):P=POINT(X+2,L):L=POINT(X+5,L):Z=Y>115AND(OORPORL):UNTILZ''
L=Y+8 - L is bottom Y position of LEM
O=POINT(X,L) - get pixel (X,L) -takes three points from the bottom of the LEM
P=POINT(X+2,L) - get pixel (X,L) -takes three points from the bottom of the LEM
L=POINT(X+5,L) - get pixel (X,L) -takes three points from the bottom of the LEM
Z= Y>115 AND (O OR P OR L) - set flag Z if y>115 and is set to one of the three points
UNTILZ - while Z == 0
====================
8G=G+0.03:CURSETX+7,Y,3:S=S+1:DATA0,12,22,47,30,12,30,51,,,48,62,60,56,32,32
G=G+0.03 - increase gravity for next level
CURSETX+7,Y,3 - set cursor position to RIGHT from LEM
S=S+1 - increase level
DATA0,12,22,47,30,12,30,51,,,48,62,60,56,32,32 - character definition data
=====================
9IFOANDPANDLANDV<2THENCHAR34,1,1:PING:WAIT200:GETA$:GOTO1ELSEEXPLODE
IF O AND P AND L AND V<2 THEN
CHAR34,1,1 - print banner to right side of the LEM
PING - ring bell sfx
WAIT200 - wait 2 seconds
GETA$ - waiting for a key to be pressed
GOTO1 - start next level
ELSE
EXPLODE - explode sfx