10 Line BASIC Challenge

=======================

Category : PUR-80

TITLE    : The Great Wall

PLATFORM : Oric Atmos

AUTHOR   : RAX

LANGUAGE : BASIC 1.1b

VIDEO    :

-------------------

Story:

Hello Captain,

A years ago, strange creatures crawled out of the ground and began attacking cities.

All cities have built firewalls to protect people.

You are the last survivor of the northern defense. The only weapons left are stones from the catapults.

The stones are at both ends of the wall and in the middle.

Good luck

--------------------

```CODE:
0DATA,12,,30,45,12,18,51,63,63,45,30,12,12,18,51,,61,61,61,,47,47,47,18,12,30'
2POKE#26A,10:LORES1:INK6:FORY=5TO20:FORX=2TO37:PLOTX,Y,163:NEXTX,Y:POKE#BBA8,6
3B=163:N=20:X=20:P=34:V=175:REPEAT:PLOTX,4,P:IFX=ZANDP=33THENP=34:DATA45,12,30
4U=U+1:K=PEEK(#208):IFK>100THENPLOTX,4,32:X=X-((K=172)*(X>2))+((K=188)*(X<37))
5IFK=132ANDP=34THENE(X)=0:FORI=6TON:PLOTX,I,V:PLOTX,I-1,B:NEXT:P=33:Z=1:O=O+10
6IFZ=1THENZ=FNR(0):PLOTZ,4,92ELSEIFX=ZTHENP=34:IFU>999THENL=L+1:U=0:DATA45,,''
7S=S+1:IFS>4THENS=L:GOSUB9ELSE:PRINT@6,0;"Man:"G" Lvl:"L" Scr:"O:UNTILE(E)>15'
8IFGTHENG=G-1:SHOOT:FORI=0TO40:E(I)=0:NEXT:GOTO2ELSEEND:DATA54,58,54,,59,55,59
9E=FNR(0):PLOTE,N-E(E),165:E(E)=E(E)+1:PLOTE,N-E(E),36:PLAY0,1,1,99:RETURN''''
RUN```

0DATA,12,,30,45,12,18,51,63,63,45,30,12,12,18,51,,61,61,61,,47,47,47,18,12,30' - character definition data

===========

DIME(40) - enemy array

DEFFNR(X)=INT(RND(1)*36)+2 - define a custom function that generates a intiger random number

FORA=0TO39:READV:POKE47368+A,V:NEXT - read the data and change the characters that will be used for sprites

G=2 - lives

===========

2POKE#26A,10:LORES1:INK6:FORY=5TO20:FORX=2TO37:PLOTX,Y,163:NEXTX,Y:POKE#BBA8,6

POKE#26A,10 - hide command prompt and disable keyboard sound

LORES1 - switch to an alternate character set on screen

FORY=5TO20:FORX=2TO37:PLOTX,Y,163:NEXTX,Y:POKE#BBA8,6 - print wall on the screen

===========

3B=163:N=20:X=N:P=34:V=175:REPEAT:PLOTX,4,P:IFX=ZANDP=33THENP=34:DATA45,12,30'

B=163 - ascii code for the wall char.

N=20 - max Y pos in enemies

X=20 - player start x pos

P=34 - ascii code for player whit stone

V=175 - ascii code for stone. that brick that the player throws

REPEAT - start iteration

PLOTX,4,P - print player in the screen

IFX=ZANDP=33THENP=34: - if x==z and player variable has is whitout stone then player variable  = player whit stone

DATA45,12,30 - character definition data

===========

4U=U+1:K=PEEK(#208):IFK>100THENPLOTX,4,32:X=X-((K=172)*(X>2))+((K=188)*(X<37))

U=U+1 - increment time counter

IFK>100THEN - if key pressed then

PLOTX,4,32 - remove player on the screen

X=X-((K=172)*(X>2))+((K=188)*(X<37)) - calc new x pos

===========

5IFK=132ANDP=34THENE(X)=0:FORI=6TON:PLOTX,I,V:PLOTX,I-1,B:NEXT:P=33:Z=1:O=O+10

IFK=132ANDP=34THEN - if pressed key space and player has stone then

E(X)=0 - remove enemy from array

FORI=6TON:PLOTX,I,V:PLOTX,I-1,B:NEXT - animate throwing a stone

P=33 - ascii code for player whitout stone

Z=1 - set flag for create new stone on wall

O=O+10 - score + 10

===========

6IFZ=1THENZ=FNR(0):PLOTZ,4,92ELSEIFX=ZTHENP=34:IFU>999THENL=L+1:U=0:DATA45,,''

IFZ=1THEN - if flag for new stoine is set then

Z=FNR(0) -  get random new position from stone from 2 to 38

PLOTZ,4,92 - print stone on wall

ELSE

IFX=ZTHEN - if player pos == stone pos then

P=34 - player  = player whit stone

IFU>999THEN - if time counter > 999 then

L=L+1   - level up

U=0 - time counter = 0

DATA45,, - character definition data

===========

7S=S+1:IFS>4THENS=L:GOSUB9ELSE:PRINT@6,0;"Man:"G" Lvl:"L" Scr:"O:UNTILE(E)>15'

S=S+1 - emeny time counter +1

IFS>4THEN - if the enemy counter is greater than 4 then

S=L - enemy counter  equal to level

GOSUB9 - move enemy

ELSE

PRINT@6,0;"Man:"G" Lvl:"L" Scr:"O - print board of "lives", "level" and 'Score'

UNTILE(E)>15 - until an enemy climbs the wall

===========

8IFGTHENG=G-1:SHOOT:FORI=0TO40:E(I)=0:NEXT:GOTO2ELSEEND:DATA54,58,54,,59,55,59

IFGTHEN - if there are lives left  then

G=G-1 - lives -1

SHOOT - sound from a shot from a rifle

FORI=0TO40:E(I)=0:NEXT - null all emeny array

GOTO2 - start again level

ELSE

END - end :)

DATA54,58,54,,59,55,59 - character definition data

===========

9E=FNR(0):PLOTE,N-E(E),165:E(E)=E(E)+1:PLOTE,N-E(E),36:PLAY0,1,1,99:RETURN''''

subroutine for enemy

E=FNR(0) - get random enemy

PLOTE,N-E(E),165 - replace emeny whit wall

E(E)=E(E)+1 - increment enemy postition

PLOTE,N-E(E),36 - print enemy on new position

PLAY0,1,1,99 - genegate litte sfx

RETURN - return from subroutine

 Status Released Author BASIC 10Liner Genre Action Tags 8-Bit, basic, basic10liner, oric-atmos

GREATWALL.tap 673 bytes
thegreatwall.txt 5 kB

## Install instructions

INSTALLATION INSTRUCTIONS

2. Copy the file GREATWALL.TAP to the Oric\tapes folder

3. Start the emulator oricutron.exe

4. Type CLOAD"GREATWALL.TAP" and press enter

5. LIST to show the program

6. Type RUN to play the game

Keyboard controls: 'Left Arrow'=Left, 'Right Arrow'=Right, 'Space'=Throw Stone