A downloadable game

10 Line BASIC 

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

Category : PUR-80 

TITLE    : The Snake Temple

PLATFORM : Oric Atmos

LANGUAGE : BASIC 1.1b

AUTHOR   : RAX


Code:

---------1---------2---------3---------4---------5---------6---------7--------
0D$="$$$b$$$b$$$b,bGb#%###3###+7+7Ea?#1>aS1$a#Ab#Vbb##/#AP/5V":A=#B507:INK6'''
1FORI=1TOLEN(D$):K=ASC(MID$(D$,I,1))-35:POKEA+I,K:NEXT:DEFFNR(X)=INT(RND(1)*X)
2DIMD(999):O=37:B=161:FORI=0TO36:D(I)=B:D(I+888)=B+1:T=INT(I*.65)*O:D(T)=B''''
3D(T+36)=B:NEXT:PAPER0:H=8:FORY=2TO23STEP2:FORX=2TO34STEP2:D(X+Y*O)=B:R=FNR(5)
4D=(R=0)-(R=1)+O*(R=2)-O*(R=3):D(X+Y*O+D)=B:NEXTX,Y:FORI=0TO924:T=D(I):?".";''
5IFT=BANDD(I+O)=0THENT=162ELSEIFT=0THENT=FNR(3)+35ELSE:D(I)=T:NEXT:Y=FNR(22)+2
6D(O+1+FNR(35)+FNR(20)*O)=38:X=FNR(35)+2:CLS:REPEAT:GETK$:Q=X:W=Y:K=ASC(K$)'''
7Y=Y+(K=11)-(K=10):X=X+(K=8)-(K=9):IFD(X+Y*O)>99THENX=Q:Y=WELSE:B=X+Y*O:Z=D(B)
8H=H-2*(Z=36)+(FNR(3)+2)*(Z=O):FORG=-1TO1:FORL=-1TO1:PLOT2+X+L,Y+G,D(B+L+G*O)'
9NEXTL,G:D(B)=35:PLOTX+2,Y,39:?@2,25;"HP:"H:UNTILZ=38ORH<1:ZAP:IFH>0THEN?"WIN"

RUN


STORY:

You are a young hero named Bocco who has set out in search of treasure in the Temple of the Snakes.

Among the labyrinth of tunnels is a treasure chest that you must find. The temple is full of snakes

so be careful!. A snake inflicts damage on 1 to 4 health points. Each flask you find restores 2 health points.

Use the arrow keys to control Bocco. Have fun :)


CODE EXPLANATION:

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

0D$="$$$b$$$b$$$b,bGb#%###3###+7+7Ea?#1>aS1$a#Ab#Vbb##/#AP/5V":A=#B507:INK6'''

    D$="$$$b$$$b$$$b,bGb#%###3###+7+7Ea?#1>aS1$a#Ab#Vbb##/#AP/5V" - characters data

    A=#B507 - the start address of characters to be modified

    INK6    - set chars color cyan

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

1FORI=1TOLEN(D$):K=ASC(MID$(D$,I,1))-35:POKEA+I,K:NEXT:DEFFNR(X)=INT(RND(1)*X)

    FORI=1TOLEN(D$)             - change characters 

        K=ASC(MID$(D$,I,1))-35  - gat data from D$

        POKEA+I,K               - change line of character

    NEXT

    DEFFNR(X)=INT(RND(1)*X)     - define custon function R to generate random number

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

2DIMD(999):O=37:B=161:FORI=0TO36:D(I)=B:D(I+888)=B+1:T=INT(I*.65)*O:D(T)=B''''

    DIMD(999)                   - maze array

    O=37                        - maze width

    B=161                       - brick character (33) with set bit 7 for invers colors 

    FORI=0TO36                  - create maze borders

        D(I)=B                  - set top border

        D(I+888)=B+1            - set bottom border

        T=INT(I*.65)*O          - calc left vertical border

        D(T)=B                  - set left border

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

3D(T+36)=B:NEXT:PAPER0:H=8:FORY=2TO23STEP2:FORX=2TO34STEP2:D(X+Y*O)=B:R=FNR(5)

        D(T+36)=B               - set right border

    NEXT

    PAPER0                      - set background color to black

    H=8

    FORY=2TO23STEP2             - generate maze

        FORX=2TO34STEP2

            D(X+Y*O)=B          - set brick

            R=FNR(5)            - get random number bettwen 0-4

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

4D=(R=0)-(R=1)+O*(R=2)-O*(R=3):D(X+Y*O+D)=B:NEXTX,Y:FORI=0TO924:T=D(I):?".";''

            D=(R=0)-(R=1)+O*(R=2)-O*(R=3)   - get direction to set next random brick

            D(X+Y*O+D)=B                    - set random brick

    NEXTX,Y

    FORI=0TO924                             - replaces the standard brick in the maze with another one for a more fancy look :), and set flask and snakes 

        T=D(I)                              - get currnet char in position 

        ?"."                                - print "." into the screen to see some processing is performed

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

5IFT=BANDD(I+O)=0THENT=162ELSEIFT=0THENT=FNR(3)+35ELSE:D(I)=T:NEXT:Y=FNR(22)+2

        IF T=B AND D(I+O)=0 THEN            - if there is a brick in the current position and there is an empty space under it, then

            T=162                           - set new brick in T

        ELSE

            IF T=0 THEN                     - if is only empty block then

                T=FNR(3)+35                 - set in T random char bettwen (35-37) (ground, flask, snake)

            ELSE

                :                           - nothing

        D(I)=T                              - set the modified value in the maze 

    NEXT

    Y=FNR(22)+2                             - get random Y position for player

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

6D(O+1+FNR(35)+FNR(20)*O)=38:X=FNR(35)+2:CLS:REPEAT:GETK$:Q=X:W=Y:K=ASC(K$)'''

    D(O+1+FNR(35)+FNR(20)*O)=38             - set chest into a maze (char 38)

    X=FNR(35)+2                             - get random X position for player

    CLS                                     - clear screen

    REPEAT                                  - game loop

        GET K$                              - get key into k$

        Q=X                                 - old X position

        W=Y                                 - old Y position

        K=ASC(K$)                           - get ascii number for pressed key

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

7Y=Y+(K=11)-(K=10):X=X+(K=8)-(K=9):IFD(X+Y*O)>99THENX=Q:Y=WELSE:B=X+Y*O:Z=D(B)

        Y=Y+(K=11)-(K=10)                   - calc new Y position

        X=X+(K=8)-(K=9)                     - calc new X position

        IFD(X+Y*O)>99 THEN                  - if there is a brick in the new position then

            X=Q                             - return the old position into X

            Y=W                             - return the old position into Y

        ELSE

            :                               - nothing

        B=X+Y*O                             - calc new player position into maze array

        Z=D(B)                              - takes the chars that is in the current player position

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

8H=H-2*(Z=36)+(FNR(4)+1)*(Z=O):FORG=-1TO1:FORL=-1TO1:PLOT2+X+L,Y+G,D(B+L+G*O)'

        H=H-2*(Z=36)+(FNR(4)+1)*(Z=O)           - calc player health whit char in playr position 

                                                ( if it is a flack then add 2 or if a snake then reduced health by 1 to 4  )

        FORG=-1TO1                              - print player area loop 3х3

            FORL=-1TO1

                PLOT2+X+L,Y+G,D(B+L+G*O)        - print current maze char 

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

9NEXTL,G:D(B)=35:PLOTX+2,Y,39:?@2,25;"HP:"H:UNTILZ=38ORH<1:ZAP:IFH>0THEN?"WIN"

        NEXTL,G

        D(B)=35                             - set ground charate into maze (removes snakes and flasks when the player passes them )

        PLOTX+2,Y,39                        - print player

        ?@2,25;"HP:"H                       - print player health on the screen

    UNTIL Z=38 OR H<1                       - do game loop while Z=38 (take chest) or H<1 (the player has no health)

    ZAP                                     - little sound effect

    IF H>0 THEN                             - if the player is healthy then 

        ?"WIN"                              - print "WIN"


Install instructions

INSTALLATION INSTRUCTIONS:

1. Download the zip file from here: http://www.petergordon.org.uk/oricutron/files/Oricutron_win32_v12.zip

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

3. Start the emulator oricutron.exe

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

5. LIST to show the program

6. Type RUN to play the game

7. When the screen turns black, you have to press a key to enter the hero in the dungeon

Download

Download
SNAKE.tap 716 bytes
Download
thesnaketemple.txt 7 kB

Leave a comment

Log in with itch.io to leave a comment.