Found bugs in the pfhline & vline code.
clplay
for n = 0 to 32
pfvline n 0 10 on
next
for n = 0 to 32
pfvline n 0 10 off
next
return
The above should clear the playfield, but leaves stripes behind. I did both of them because I also think turning a pixel off on a line by line basis does not work correctly each time either.
Also, I'm having trouble with some gosubs.
I know this will be long, but check out this next listing:
rem smartbranching on
reset
gosub title
rem Init Game code
rem
rem x, w, v = ship and bullet position variables
rem
rem
rem
COLUP0 = 120 : COLUP1 = 47
x = 50 : w = 60 : v = 60
rem
s = 0
rem s = game status flags
rem s(0) = bullet launched
goto clplay
gameloop
COLUPF = 43 : COLUP0 = 120 : scorecolor = 10 : COLUP1 = 47
PF0 = 140
player1x = w : player1y = v : player0x = x : player0y = 89
player0:
%01000010
%11100111
%11111111
%01111110
%00111100
%00011000
%00011000
%00011000
end
player1:
%00011000
%00010000
%00001000
%00010000
%00001000
end
drawscreen
rem GameCode
gosub checkswitches
gosub moveship
gosub moveshot
goto gameloop
rem Subroutines Live below Here
moveship
if joy0left then x = x - 1
if joy0right then x = x + 1
if x < 35 then x = 35
if x > 147 then x = 147
return
moveshot
if !s(0) then goto fire
if joy0fire then s(0) = 1 : goto fire
w = x : v = 89 - 8
goto shotdone
rem bit operators are working backward, change this code when it gets
rem fixed. Symptom will be always shooting.
fire
v = v - 4
if v < 3 then s(0) = 0 : v = 89 - 8 : w = x
shotdone
return
checkswitches
if switchreset then goto reset
return
title
COLUPF = 45 : a = 0 : b = 0
titleloop
COLUPF = b
drawscreen
if joy0fire then goto titleexit
if switchreset then goto reset
gosub drawdot
goto titleloop
data titlemap
0,0,0,0,1,1,0,0,0,1,1,0,0,1,1,1,1,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0
0,0,0,1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,1,0,0,1,0,1,0,0,1,0,0,1,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,1,0,0,1,0,1,0,0,1,0,1,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,0,1,1,0,0,0,1,1,0,0,1,1,1,1,0,1,1,1,1,0,1,0,1,0,1,0,0,0,0
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,1,1,1,0,1,0,1,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
0,0,0,1,1,1,1,0,1,0,1,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0
end
drawdot
if b > 240 then b = 0 : x = 0 : a = 0
if titlemap[b] = 1 then d = a + 2 : pfpixel x d flip
x = x + 1
if x > 32 then a = a + 1 : x = 0
b = b + 1
return
titleexit
for y = 0 to 9
pfhline 0 y 31 off
next
return
clplay
for n = 0 to 32
pfvline n 0 10 on
next
for n = 0 to 32
pfvline n 0 10 off
next
goto gameloop
If you replace the goto clplay, near the top, with gosub clplay and also change the goto gameloop at the bottom with a return, it won't compile, and it should. Seems to get confused on the labels. Does not matter where you put the code either.
I remember this problem with 0.1 too. Happened after I tried to insert a title screen. Thought this time around, I would go ahead and build the screen first, then try and write the game inbetween the two drawscreen calls. Maybe this has nothing to do with it.