Here's the latest version of the game... it's gotten to the point where you can actually call it a game now!
However, there's some weird, quirky crap going on that I can't quite figure out. I tried to randomize the location of the fuel pods that you collect to stay alive. The problem with this was that the pods would sometimes land right on top of you, giving you undeserved points.
My solution for this was to toggle the location of the pods from left to right and back again. Great idea, right? The compiler doesn't seem to agree. Rather than shifting the position of the pods from left to right, it wants to put them on whatever side it damned well pleases, despite my rewriting the toggle code several different times.
The game also insists on ramping the difficulty much too quickly. You're supposed to collect three fuel pods before the fireball picks up speed, but it almost seems to happen purely by chance... picking up one pod is sometimes enough to turn the sluggish projectile into a blazing ball of fury.
Finally, there's the slight annoyance of double deaths. After you're struck by the fireball, pressing the fire button causes you to die again the moment you appear onscreen, even though the positions of both characters have been reset. This doesn't happen when you run out of fuel, however, which to say the least strikes me as weird.
If you've got any idea what I'm doing wrong, let me know. I'm including the code with this post.
1 rem smartbranching on
2 rem Fireball dodgin' game
3 rem by Jess Ragan, for Batari BASIC
4 rem
5 rem initialize all variables used in the program
6 rem x/y is ship position, a/b is fireball position
7 rem v/w is ship direction, c/d is fireball direction
8 rem t is fuel gauge, u is game timer, l is level
9 rem
10 x = 90 : y = 45 : v = 0 : w= 255 : t = 24 : u = 0 : s = 1 : f = 0
20 a = 45 : b = 24 : c = 1 : d = 1 : l = 1 : j = 140 : k = 60 : p = 0
30 score = 0
31 rem set up screen; character positions
32 rem fuel pods will be included next
33 rem
40 COLUPF = 128
50 COLUP0 = 84 : player0x = x : player0y = y
60 COLUP1 = 68 : player1x = a : player1y = b
65 missile0x = j : missile0y = k : missile0height = 2
70 scorecolor = 15
80 pfhline 8 10 24 on
81 rem choose animation frames
82 rem ship animation depends on current direction
83 rem
90 if w <> 255 then 110
100 player0:
%10000001
%10011001
%11011011
%11111111
%10111101
%00011000
%00011000
%00011000
end
110 if w <> 1 then 130
120 player0:
%00011000
%00011000
%00011000
%10111101
%11111111
%11011011
%10011001
%10000001
end
130 if v <> 255 then 150
140 player0:
%00011111
%00001100
%00011000
%11111111
%11111111
%00011000
%00001100
%00011111
end
150 if v <> 1 then 170
160 player0:
%11111000
%00110000
%00011000
%01111111
%01111111
%00011000
%00110000
%11111000
end
161 rem fireball animation is next on the menu
162 rem fireball animation dependant on the 'u' timer
163 rem
170 if u > 4 then goto 200
180 player1:
%00001000
%00010000
%00010000
%10011110
%01111001
%00001000
%00001000
%00010000
end
190 goto 210
200 player1:
%00100000
%01000010
%00100101
%00011000
%00011000
%10100100
%01000010
%00000100
end
201 rem joystick movement determines ship's direction
202 rem
210 if joy0up then v = 0 : w = 255
220 if joy0down then v = 0 : w = 1
230 if joy0left then v = 255 : w = 0
240 if joy0right then v = 1 : w = 0
241 rem screen borders stop ship from advancing
242 rem
250 if x < 20 then x = 20
260 if x > 160 then x = 160
270 if y < 10 then y = 10
280 if y > 80 then y = 80
281 rem screen borders reverse fireball's direction
282 rem
290 if a < 20 then c = 1
300 if a > 160 then c = 255
310 if b < 10 then d = 1
320 if b > 80 then d = 255
321 rem move onscreen characters
322 rem ship is propelled forward at a constant rate
323 rem
330 x = x + v : y = y + w
340 for i = 1 to l : a = a + c : b = b + d : next i
341 rem holding down fire button activates retro rockets
342 rem this doubles the speed of your ship
343 rem
350 if joy0fire then x = x + v : y = y + w
351 rem it's the final countdown!
352 rem the 'u' timer advances. When it reaches ten
353 rem 'u' is reset to zero and the fuel gauge shrinks
354 rem
360 u = u + 1
370 if u = 10 then pfpixel t 10 flip : t = t - 1 : u = 0
371 rem watch your fuel gauge. Keep it replenished
372 rem by grabbing fuel pods. If you fail to
373 rem collect a pod in time, you will perish!
374 rem
380 if t = 7 then 1000
381 rem set player sprites, then draw them
382 rem
390 COLUP0 = 84 : player0x = x : player0y = y
400 COLUP1 = 68 : player1x = a : player1y = b
401 rem time for some blinking fuel pod action!
402 rem
410 missile0x = j : missile0y = k : missile0height = 2
420 NUSIZ0 = $00
430 if u < 5 then 450
440 NUSIZ0 = $10
441 rem check for collisions
442 rem
450 if !collision(player0,player1) then 1000
455 if !collision(player0,missile0) then gosub 2000
460 drawscreen
461 rem you go back, Jack, and do it again
462 rem wheels turnin' round and round
463 rem
470 goto 90
995 rem it's game over, dude!
996 rem the ship cycles through colors then
997 rem vanishes from sight. Press the fire
998 rem button or reset to restart the game
1000 for t = 1 to 5
1010 for i = 16 to 30
1020 COLUP0 = i : scorecolor = i : player0x = x : player0y = y
1030 COLUP1 = 64 : player1x = a : player1y = b
1040 drawscreen
1050 next : next
1060 if switchreset || joy0fire then 10
1070 COLUP0 = 0 : scorecolor = 15 : player0x = x : player0y = y
1080 COLUP1 = 64 : player1x = a : player1y = b
1090 drawscreen
1100 goto 1060
1991 rem when the ship touches a fuel pod,
1992 rem the player's fuel supply is restored
1993 rem and points are awarded depending on
1994 rem what fuel is remaining. The next pod
1995 rem is placed randomly on the screen
1996 rem
2000 i = t - 6
2010 for t = 1 to 5
2020 i = i * 5
2030 next
2040 score = score + i
2050 t = 24 : pfhline 8 10 24 on
2060 rand = a
2070 if s = 0 then s = 1 : j = 40 : goto 2090
2080 s = 0 : j = 140
2090 k = rand
2100 if k > 70 then k = k - 70 : goto 2100
2110 k = k + 10
2120 f = f + 1
2130 if f = 3 then f = 0 : l = l + 1
2140 if l = 6 then l = 1 : p = p + 1
2150 if p = 6 then l = 5 : p = 5
2160 return
JR