A downloadable tool

Category : SCHAU

TITLE    : Ascii Tank

PLATFORM : Oric Atmos

LANGUAGE : BASIC 1.1b

AUTHOR   : RAX

VIDEO    :

This is a small program that animates an ASCII aquarium in 10 lines, 618 characters, and 80 characters per line (more precisely 77, as this is the permissible standard limit on the ORIC computer).

The aquarium consists of:

    - a castle at the bottom of the screen,

    - 4 fish in different colors,

    - 1 air bubble floating to the surface of the water,

    - 2 green seaweeds.

I found it quite interesting that all the elements move at a good speed. Initially, I thought this would run very slowly (as it did in the first attempts at this aquarium) :).


CODE:

0---------1---------2---------3---------4---------5---------6---------7-----78
0DEFFNR(X)=INT(RND(1)*X):A$="<)<  ":B$="  >(>":C$="    ":POKE#26A,10:LORES0'''
1Z$="  |> v-v-v  |>/ \ |   | / \|o|'''''''|o|| |[] - []| || |  |#|  | |":B=22'
2A=1:FORY=0TO4:FORX=0TO12:A=A+1:PLOT3+X,19+Y,MID$(Z$,A,1):NEXTX,Y:R=6:W=9:I=6'
3FORA=1TO18:PLOTA*2,0,"..":PLOTA*2,24,"~~":PLOT0,A,FNR(6)+1:PLOT27,5+A,2:NEXT'
4D$=CHR$(7)+"o":D=20:F=22:REPEAT:PLOTD-2,F,C$:F=F-1:PLOTD+FNR(3)-2,F,D$:V=1-V'
5PLOTQ,W,B$:Q=Q+1:PLOTE,R,B$:E=E+2:PLOTT,Y,A$:T=T-1:PLOTU,I,A$:U=U-2:N=40+V'''
6IFQ>34THENPLOTQ,W,C$:Q=3:W=FNR(15)+3ELSE:IFE>34THENPLOTE,R,C$:E=3:R=FNR(15)+3
7M=41-V:PLOT30,23,M:PLOT30,B,N:IFT<2THENPLOTT+1,Y,C$:T=35:Y=FNR(15)+3'''''''''
8PLOT35,23,N:PLOT35,B,M:IFU<2THENPLOTU+2,I,C$:U=35:I=FNR(15)+3''''''''''''''''
9PLOT35,21,N:PLOT35,20,M:IFF<3THENPLOTD-2,F,C$:F=23:D=FNR(5)+20ELSE:UNTIL0''''
RUN

0   DEFFNR(X)=INT(RND(1)*X)  ' Defines function FNR(X), which generates a random number from 0 to X-1

    A$="<)<  "               ' Defines string A$ – characters for a fish swimming left

    B$="  >(>"               ' Defines string B$ – characters for a fish swimming right

    C$="    "                ' Defines empty space (used for erasing characters)

    POKE#26A,10              ' Stops system blinking cursor and the sounds when pressing a key

    LORES0                   ' Enables low graphics resolution (LORES mode)


1   Z$="  |> v-v-v  |>/ \ |   | / \|o|'''''''|o|| |[] - []| || |  |#|  | |" ' Defines a text string used for the castle at the bottom of the aquarium

    B=22                     ' Variable B = 22 (used for positioning the seaweed on the Y-axis)


2   A=1                      ' Initializes counter A for extracting characters from the castle string

    FOR Y=0 TO 4             ' Drawing the castle. Outer loop for Y (5 rows)

        FOR X=0 TO 12        ' Inner loop for X (13 columns)

            A=A+1            ' Increases the index in string Z$

            PLOT 3+X,19+Y,MID$(Z$,A,1) ' Extracts characters from Z$ and draws the castle in the aquarium

        NEXT X,Y             ' Ends the loop

    R=6                      ' Initializes R (fish 2)

    W=9                      ' Initializes W (fish 1)

    I=6                      ' Initializes I (fish 4)


3   FOR A=1 TO 18            ' Loop for drawing borders and bubbles

        PLOT A*2,0,".."      ' Draws the top part of the water

        PLOT A*2,24,"~~"     ' Draws the bottom part of the water

        PLOT 0,A,FNR(6)+1    ' Sets a random ink code on the left side of the screen to make fish have different colors on each row

        PLOT 27,5+A,2        ' Sets a green color attribute for the seaweed (INK 2)

    NEXT                     ' End of loop


4   D$=CHR$(7)+"o"           ' Defines the symbol for bubbles (sound + "o")

    D=20                     ' Initializes D (bubble X position)

    F=22                     ' Initializes F (bubble Y position)

    REPEAT                   ' Starts an infinite loop


5       PLOT D-2,F,C$        ' Clears the previous position of the bubble

        F=F-1                ' Moves the bubble upwards

        PLOT D+FNR(3)-2,F,D$ ' Draws the new position of the bubble

        V=1-V                ' Alternates V to switch values for the seaweed

        PLOT Q,W,B$          ' Draws a fish moving right

        Q=Q+1                ' Moves the fish

        PLOT E,R,B$          ' Draws another fish

        E=E+2                ' Moves the second fish

        PLOT T,Y,A$          ' Draws a fish moving left

        T=T-1                ' Moves the fish

        PLOT U,I,A$          ' Draws another fish

        U=U-2                ' Moves the second fish left

        N=40+V               ' Calculates the ASCII code for the seaweed (one of the two small brackets)


6       IF Q>34 THEN         ' Checks if the fish has left the screen

            PLOT Q,W,C$      ' Clears the old position

            Q=3              ' Resets the position

            W=FNR(15)+3      ' Generates a new height

        ELSE

        :                    ' Nothing

        

        IF E>34 THEN         ' Checks the second fish

            PLOT E,R,C$      ' Clears the old position

            E=3              ' Resets the position

            R=FNR(15)+3      ' Generates a new height


7       M=41-V               ' Calculates the ASCII code for the seaweed's second value (the other bracket)

        PLOT 30,23,M         ' Draws seaweed with the first bracket character

        PLOT 30,B,N          ' Draws seaweed with the second bracket character

        IF T<2 THEN          ' If the fish reaches the end

            PLOT T+1,Y,C$    ' Clears the old position

            T=35             ' Resets the position

            Y=FNR(15)+3      ' Generates a new height


8       PLOT 35,23,N         ' Draws seaweed with the second bracket character

        PLOT 35,B,M          ' Draws seaweed with the first bracket character

        IF U<2 THEN          ' Checks if another fish has reached the end

            PLOT U+2,I,C$    ' Clears the old position

            U=35             ' Resets the position

            I=FNR(15)+3      ' Generates a new height


9       PLOT 35,21,N         ' Draws seaweed with the second bracket character

        PLOT 35,20,M         ' Draws seaweed with the first bracket character

        IF F<3 THEN          ' If the bubble reaches the top edge

            PLOT D-2,F,C$    ' Clears the old position

            F=23             ' Resets the Y position

            D=FNR(5)+20      ' Generates a new starting X position

        ELSE

        :                    ' Nothing

    UNTIL 0                  ' Infinite loop

Published 17 days ago
StatusReleased
CategoryTool
Rating
Rated 5.0 out of 5 stars
(1 total ratings)
AuthorBASIC 10Liner
Tags10liner, 8-Bit, basic, oric, oric-atmos

Download

Download
TANK.tap 660 bytes
Download
tank.txt 6.5 kB
Download
tanktw.mp4 1.7 MB
Download
tank-code.jpg 87 kB

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 TANK.TAP to the Oric\tapes folder

3. Start the emulator oricutron.exe

4. Type CLOAD"TANK" and press enter

5. LIST to show the program

6. Type RUN to play the game

Comments

Log in with itch.io to leave a comment.

z  e  n

Great animation and ASCII art!

Neat

Well done! :)

very good

Watching this is very relaxing! ;-)

Excellent, thanks for the programming teaching, will get the oric out and give it a go.