Copyright © 2024 by Víctor Parada
This is a little game for the 2024 NOMAM's BASIC 10-liners Contest. This program fits in the PUR-120 category, and it was written using FastBasic 4.6 for the 8-bits ATARI XL/XE computers line. Development started on 2024-03-07, and it took 4 days. The final version's date is 2024-03-14.
Catch as many flies in a row hanging with your web. Beware, the frog is lurking from the puddle.
The puddle is always full of flies. Press the button to begin the hunt! | |
You are the spider over the tree branch and you have to catch every single fly. You can move to the left and to the right through the branch using the joystick. | |
With the button, you can hang using your cobweb and go down to catch the flies. You earn a point for every fly you catch. | |
There is a frog hidden in the puddle. You can see it peek out when you are close to it. | |
Sometimes, the frog will jump out of the water trying to eat you. Avoid hanging where the frog is lurking. | |
There is only one life. The game is over when the frog eats you or when you miss a fly. Press the button to try again. |
A ZPH show featured a WIP game called "Fly Hunter" for the Atari 2600 console that was very attractive. It was published by 8bitPoet in the AtariAge forum. It started as a very simple gameplay, but it got many new elements soon after some comments of the community. The version that was presented in the show had many simple animations that improved the gameplay.
Initial 2600 version by 8bitPoet, with a worm as the enemy.
Current WIP version, using a frog instead of a worm.
I was impressed by the game and I thought that I could port it as a simple BASIC tenliner, so I started a prototype. The first thing I did was to design the sprite bitmaps. Using DLI feature of Fastbasic it could be simple to recreate the playfield, where I did the first animation: the frog jump, including the water splash. Then, I added the spider and made it move to the sides and to hang.
Initial prototype of a jumping frog and a splash.
Added the spider (showing one frame of the splash animation).
When I added the fly, I decided to change the bitmaps of the sprites, because I wouldn't use hitboxes but P/M collisions, and that required to separate the spider from the web and use two different P/M graphics in order to not caprure the fly using the web while hung. I added the score, but immediatelly noticed a problem: no more room for more BASIC source code. At that point, the animations were nice, but there were no sound FXs and game dynamics were not the way I wanted. Almost everything moved at the same speed, fast, but difficult to play, so it also needed space for tweaking. I had to decide which features must be removed to recover some coding space, and the splash and the wavy fly gone away.
New playfield, but less FXs.
After couple of days tweaking and commenting the code, I could have a working release candate. I sent it to some friends to betatest it and receive some feedback. A couple of hours later, I think I have it, and used the extra bytes to enhance some FXs.
Get the FLYHUNT.ATR file and set it as drive 1 in a real Atari (or emulator). Turn the computer on and the game should start after the loading completes. A joystick in port 1 is required.
NOTE: This game is for PAL computers. Use the file FHNTSC.XEX included in the ATR to be played on NTSC computers.
The abbreviated BASIC code is the following:
The full and expanded BASIC listing is:
|
Fly Hunter 10L (c) 2024 Víctor Parada |
|
P/M graphics - P0: Frog - P1: Fly - P2: Spider - P3: Web thread No missiles are used. |
d=adr("{binary data}")+1 |
0 (9 bytes): Spider in tree bitmap 6 (14 bytes): Falling spider bitmap 20 (6 bytes): Web bitmap 23 (32 bytes): Frog bitmap 55 (8 bytes): Display list portion with DLI enabled 63 (9 bytes): Color palette |
move $E000,$7000,512 mset $7018,8,$FF |
Copy the charset to RAM and replace one char with a block to draw the tree |
graphics 18 poke 756,$70 |
Set up graphics mode 2 (ANTIC 7) 20x12 without text window |
move d+55,dpeek(560)+7,8 |
Enable DLI bit on some DL lines |
a=dpeek(88) |
Pointer to the playfield |
pmgraphics 2 |
Enable double line resolution P/M graphics |
poke $D008,1 |
Set P0 (frog) double width |
data c() byte=$8A,$B6,$84 dli set _d=c into $D01A dli _d |
Enable DLI to set playfield colors |
move d+63,704,9 |
Set color palette |
for b=0 to 9 dpoke a+b*20+16,$8383 next b mset a+21,19,$83 |
Draw the trunk and branches of the tree |
position 3,5 print #6,"fly hunter" |
Print game title |
do |
MAIN LOOP |
mset pmadr(0),512,0 |
Clear P/M players area |
while strig(0) wend |
Waiting for the fire button to start |
e=0 |
Score |
f=0 |
Frog height |
r=240 |
Frog horizontal position |
mset a+103,10,0 |
Clear midscreen message |
mset a+229,9,0 |
Clear score |
k=0 |
Killed flag |
m=0 |
Fly horizontal position |
n=0 |
Fly speed |
o=0 |
Frog and fly timer |
y=0 |
Spider height (0 when it is at the branch) |
x=99 |
Spider horizontal position |
z=1 |
Force display of the spider |
poke $D01E,0 |
Clear P/M collisions |
repeat |
GAME LOOP |
o=(o+1)&3 |
Update timer, iterates between 0 and 3 |
b=strig(0) + k + z |
Moving the spider? Releases the button if killed (button is pressed when STRIG=0) |
if b=0 or y |
Is the button pressed or already hanging? |
if b and y |
Is the spider hanging and the button is not pressed? |
dec y |
Return a step to the tree branch |
elif y<22 and not b |
Is the button pressed and not at the bottom? |
inc y endif |
Enlarge the thread one step |
if y |
Is the spider hung? |
sound 0,10+y+y,10,y<22 |
Yes... turn on sound. |
t=pmadr(2)+y*3+17 |
Precompute bitmaps and P/M destination area to display P/M area of the spider |
w=t+131 |
Bitmap of the hanging spider |
v=d+20 |
P/M area of the thread |
s=d+6 |
Bitmap of the tread |
u=14 else |
Size of the spider bitmap |
z=1 endif |
Flag to use the walking spider bitmap |
else b=stick(0) x=x+((b=7)*(x<166)-(b=11)*(x>56))*2 z=1 endif |
Walk only if not hanging |
if z |
Put the spider over the tree branch. |
t=pmadr(2)+22 |
P/M area of the spider |
s=d |
Bitmap of the walking spider |
u=9 |
Size of the spider bitmap (including extra zeroes below to remove the last hung spider bitmap) |
v=a |
P/M area of the thread (using the blank area of the screen because there is no thread while walking) |
w=t+128 |
Bitmap of the hanging spider |
sound 0 endif |
No sound |
if f=0 and abs(x-r)<3 and rand(9)<=y/4 |
If the frog is in the water and is almost below the spider, jump at a chance of 1/9 (or up to 6/9 if hanging) |
f=1 |
Set frog height |
g=1 endif |
Set frog jump flag and direction |
if m |
Is a fly in the playfield? |
m=m-(o&1!n) |
Move it to the left at its current speed |
if m<30 then k=1 |
If the fly reached the left side of the playfield, the game is over |
else |
Need to put a fly |
m=216 |
Set fly horizontal position at the right |
n=rand(5)=0 |
Quick fly in a chance of 1/5 |
dpoke pmadr(1)+40+rand(46),$0703 endif |
Put a fly at a random height |
if g |
Is the frog jumping? |
f=f+g |
New height |
j=32 |
Set the full frog bitmap to be drawn |
if f<8 then j=4*f |
Is the frog still touching the water? Display only a portion of the bitmap |
sound 1,200-f*3,12,12 |
Jumping FX |
if f>20 |
Reached the top? |
g=-1 |
Change direction |
elif f=0 |
Returned to water? |
g=0 |
Disable jump |
r=255-e mod 100 |
Move frog to the right (higher the score, closer to the center of the playfield) |
sound 1 endif |
Stop the jumping sound |
i=pmadr(0)+99-f*4 endif |
Precompute P/M memory area to display the bitmap |
if not f |
Move the frog in the water |
r=r+sgn(x-r)*(o=0) pmhpos 0,r |
Follow the spider at 1/4 of the spider speed (every 4th frame). |
b=0 if abs(x-r)<20 then b=$1C14 dpoke pmadr(0)+97,b endif |
Show frog's eyes only if it is near the spider |
if peek($D00C)&4 k=1 |
Check if the frog ate the spider |
x=0 y=0 |
Move the spider and cobweb out of the playfield |
sound 0 |
Stop hanging sound (if any) |
if f then g=-1 endif |
Let the frog return to the water |
if peek($D00D)&4 sound 0,9,8,8 |
Check if the spider ate the fly |
mset pmadr(1),128,0 m=0 |
Move the fly out of the playfield to avoid double scoring after clearing collisions register |
poke $D01E,0 |
Clear P/M collisions |
inc e position 9,11 print #6,e endif |
Increase the score |
poke 77,0 |
Disable attract mode |
pause 0 |
Sync the frame to avoid glitches |
move s,t,u move v,w,6 pmhpos 2,x pmhpos 3,x |
Display the spider (and web thread) |
pmhpos 1,m |
Display the fly |
if g then move d+23,i,j |
Display the frog |
z=0 |
Disable force flag to display of the spider over the branch |
until y+f=0 and k |
Game loop ends when killed and the frog is not jumping and the spider is not hung |
position 4,5 print #6,"game over" |
Print Game Over message |
for b=2 to 8 sound 0,b*30,6,13-b pause 5 sound pause 2 next b |
Final sound FX |
loop |
End of main loop |
Return to my 10-liners page.
© 2024 by Víctor Parada - 2024-03-14 (updated: 2024-03-16)