A downloadable game

           BASIC Tenliners Contest 2021

                              Life Raft Rescue              
         (c) 2020 Roman Werner @romwer 
           email: roman.werner@gmail.com 

"Mayday, mayday! Our vessel MS Viking Star is sinking. Please send a rescue team!".
You are stationed on the aircraft carrier HMS Colossus near Iceland, receiving the desparate call for help.
Checking the situation you realize that the Colossus is the closest ship in reach and no time to waste: A heavy storm is forecasted to come your way.
Equipped with a rescue helicopter and trained for emergencies like this you accept the call and it does not take long until the deep "thud thud thud" sound of the rotor blades dominate the air.
But what is that: the fuel tank is almost empty! "Go go go! We refill again while we unload the rescued". God help us all!

Task and Goal
Control the rescue helicopter around the sea and find and pick up the 10 life rafts reported to be floating in the frozen waters of the atlantic ocean.
Every life raft is further away than the last one and therefore more difficult to spot. Find a way to not lose orientation in the open sea otherwise you will not find back to your aircraft carrier.
Fuel is short and you must return to the Colossus in order to refill enough gasoline for another rescue attempt. If the fuel is used up while in air then you and your crew will crash and the game is over.
Good Luck!

Use Joystick in Port 2 for moving in all eight directions

Game Requirements:
- C64/C128* with BASIC 2.0 runtime environment (or compatible)
- 1 Player

*Also playable on Windows/MacOS/iOS/Android (C64 Emulator required)

Starting in VICE: C64 emulator (http://vice-emu.sourceforge.net/):
Start the emulator and then drag and drop the "liferaftrescue.prg" into the VICE window.
Load the program with the command: load "liferaftrescue.prg",8
Then start the program with:       run

Life Raft Rescue BASIC program code:
1f$=f$+"{cm k}":next:t=10:p=o+f:k=8:a=f*k:pokea,13:print"{light blue}{clear}";:poke210,208:printtab(21)"1{right}1{right*3}5{right}1{right*2}66"
8c=peek(j):print"{home}{pink}fuel {yellow}"right$(f$,z/17)" "tab(29)"{pink}rescued{yellow}"m:z=z-1:ifzandm<tgoto3
9pokev,0:print"{home}{light blue}{down*12}"tab(15)mid$("game overall saved",1-(m=t)*9,9):waitj,16,16:run
Life Raft Rescue BASIC program code (PUR-80 version using command abbreviations):
1f$=f$+"{cm k}":nE:t=10:p=o+f:k=8:a=f*k:pOa,13:?"{light blue}{clear}";:pO210,208:?tA21)"1{right}1{right*3}5{right}1{right*2}66"
8c=pE(j):?"{home}{pink}fuel {yellow}"rI(f$,z/17)" "tA29)"{pink}rescued{yellow}"m:z=z-1:ifzaNm<tgO3
9pOv,0:?"{home}{light blue}{down*12}"tA15)mid$("game overall saved",1-(m=t)*9,9):wAj,16,16:rU

Tip: Copy/paste the program-Code into CBM prg Studio (http://www.ajordison.co.uk/).
There you can see the commands in nice color highlighting and you can directly execute the game in an emulator of your choice.

Life Raft Rescue Tenliner explained (000=row 0/100=row 1/...):
000 x=168: rem initial helicopter x-position
001 y=120: rem initial helicopter y-position
002 s=4^5: rem 1024 (screen base address)
003 v=s*52: rem 53248 (vicii base addres)
004 n=v+s: rem 54272 (sid base address)
005 j=s*55: rem 56320 (joystick port 2)
006 o=1523: rem screen position for helicopter character
007 f=255: rem fix constant
008 fori=6to51step3: rem for 15 times...
009 poke832+i,189ori: rem use byte pattern to create aircraft carrier sprite

100 f$=f$+"{cm k}": rem create string for remaining fuel display
101 next
102 t=10: rem total life rafts to be rescued
103 p=o+f: rem define initial screen address for wave "." symbol
104 k=8: rem fix constant
105 a=f*k: rem 2040 (base address of sprite pointers)
106 pokea,13: rem set sprite pointer 0 to point to address 832 (13x64)
107 print"{light blue}{clear}";: rem clear screen and fill with new color
108 poke210,208: rem hack to change screen base address for print to 53248 (vicii)
109 printtab(21)"1{right}1{right*3}1{right}1{right*2}66": rem see below
110 rem the print statement in line 109 has the following effect:
111 rem pokev+21,1: rem sprite 0 visible
112 rem pokev+23,1: rem sprite 0 double-height
113 rem pokev+27,1: rem sprite 0 to appear behind background
114 rem pokev+29,1: rem sprite 0 double-width
115 rem pokev+32,6: rem set border to blue
116 rem pokve+33,6: rem set background to blue

200 i=rnd(.)*k: rem random angle for raft position
201 r=t+m*7: rem increase perimeter distance each round
202 q=x+int(cos(i)*r)*k: rem calculate x-offset of current life raft position
203 r=y+int(sin(i)*r)*k: rem calculate y-offset of current life raft position
204 w=32: rem fix constant
205 l=40: rem fix constant
206 poke886,126: rem set bottom of aircraft carrier sprite data

300 b=5-b: rem 5 or 0 (switches every loop cycle) used for the helicopter rotor animation
301 on128-cgoto700: rem skip direction handling when joystick is in neutral position
302 d=sgn(candk)-sgn(cand4): rem right-left = 1 or -1
303 e=sgn(cand2)-(cand1): rem down-up = 1 or -1
304 x=x+d*k: rem calculate new helicopter x-position
305 y=y+e*k: rem calculate new helicopter y-position
306 pokep,w: rem clear previous wave position (poking space to wave screen address)

400 p=p+e*l+danda+7ors: rem calcluate new wave screen position relativ to movement
401 p=p+(p=a): rem prevent overwriting sprite pointer 0 by accident
402 pokep,46: rem show wave symbol on new screen position
403 onhgoto600: rem go to 600 when life raft is already on board
404 poken+g,14: rem set color at previous life raft screen address back to light blue (for wave)
405 pokeg,w: rem rem clear previous life raft position (poking space to life raft screen address)
406 ifq=xthenifr=ythenh=1:goto600: rem if helicopter position is same as life raft then flag as "on board"

500 ifq>x-168thenifq<x+160thenifr>y-104thenifr<y+96theng=o-(r-y)*5-(q-x)/k:poken+g,t:pokeg,87
501 rem poke life raft color and character at relative screen address only when in sight

600 ify>.thenify<fthenpokev+21,-(x>.andx<349):pokev,x+4andf:pokev+16,-(x>f):u=y+2andf:pokev+1,u
601 rem show aircraft carrier sprite only when in sight

700 poken+4,22-b: rem play sound fx (waveform 16 + gate switches between 0 and 1)
701 pokeo,86+b: rem display helicopter symbol (switches between + and x)
702 ifpeek(v+31)thenifu>99thenz=f:poken+24,f:poken+1,t:ifhthenm=m+h:h=0:goto200
703 rem when helicopter touches aircraft carrier then fill up fuel and unboard raft
704 rem also some initial sound settings are applied here because it did not have room anywhere else

800 c=peek(j): rem read joystick value
801 print"{home}{pink}fuel {yellow}"right$(f$,z/17)" "tab(29)"{pink}rescued{yellow}"m: rem print fuel/rescued rafts status
802 z=z-1: rem count down fuel
803 ifzandm<tgoto300: rem as long as there is enough fuel and player has not rescued all 10 rafts, remain in game loop

900 pokev,0: rem hide aircraft carrier to not overlap with upcoming text
901 print"{home}{light blue}{down*12}"tab(15)mid$("game overall saved",1-(m=t)*9,9): rem print final outcome text
902 waitj,16,16: rem wait for joystick fire button
903 run: rem restart game

2020 rem basic 10liners contest / (c) roman werner @romwer roman.werner@gmail.com

!- a  = 2040 (base address of sprite pointers)
!- b  = 5 or 0 (switches values every loop cycle) used for the helicopter rotor animation
!- c  = Joystick direction (127 if not pressed)
!- d  = 1 or -1 when joystick is pressed left or right. Otherwise 0.
!- e  = 1 or -1 when joystick is pressed up or down. Otherwise 0.
!- f  = 255 (constant)
!- f$ = string with block elements to show remaining fuel
!- g  = calculated screen address of life raft (when in sight)
!- h  = flag (0=life raft on sea / 1=life raft on board)
!- i  = temporary variable for loops and such
!- j  = 56320 (Joystick Port 2)
!- k  = 8 (constant)
!- l  = 40 (constant)
!- m  = number of rescued life rafts
!- n  = 54296 (SID base address)
!- o  = helicopter screen memory address (middle of screen offset)
!- p  = calculated screen address for wave "." symbol
!- q  = x-offset of current life raft position
!- r  = y-offset of current life raft position
!- s  = 1024 (base address of Screen memory)
!- t  = 10 (constant)
!- u  = helicopter y-position (0-255) when aircraft carrier is on screen
!- v  = 53248 (VIC base address)
!- w  = 32 (constant)
!- x  = helicopter x-position
!- y  = helicopter y-position
!- z  = fuel counter

The scene in the PETSCII title picture is based on the historic recovery of the Appollo 13 team by a US Navy Sikorsky SH-3D Sea King.


liferaftrescue.prg 813 bytes

Development log

Leave a comment

Log in with itch.io to leave a comment.