Captain Spazer Posted September 7, 2016 Share Posted September 7, 2016 (edited) I'm getting a weird glitch with my pfscore 2, I'm using it as a timer so it's set to 255. Sometimes it works as it should, but sometimes it's like it gets flipped and overlaps the score, and I'm sometimes having issues with pfscore1 too, it's set to 21 to indicate lives, sometimes when a life is lost they jump a little to the right and behaves in a weird way. Any ideas what I've done wrong? This is a techdemo in the style of a WarioWare game, a timer counts down from 3 then a random microgame starts, if you win it you are awarded 1 point, if you fail you lose a life, rince and repeat with 4 microgames. Code: title drawscreen if switchreset then goto reset goto title reset score=0 a=0 b=0 c=0 d=0 e=0 f=0 g=0 h=0 i=0 j=0 k=0 l=0 m=0 n=0 o=0 p=0 q=0 r=0 s=0 t=0 o=0 p=0 q=0 r=0 s=0 t=0 u=0 v=0 w=0 x=0 y=0 set smartbranching on const pfscore=1 pfscore1 = 21 pfscore2 = 255 dim rand16 = z const font = retroputer countdown scorecolor=$0E pfscore2=0 pfclear COLUBK=$00 ballx=255 : bally=255 player1x=255 : player1y=255 player0x=255 : player0y=255 AUDV0=0 COLUPF=$00 b=0 c=0 d=0 e=0 f=0 g=0 h=0 i=0 j=0 k=0 l=0 m=0 n=0 o=0 p=0 q=0 r=0 s=0 t=0 o=0 p=0 q=0 r=0 s=0 t=0 u=0 v=0 w=0 x=0 y=0 COLUP0=$0E NUSIZ0=$07 player0x=70 : player0y=50 a=a+1 if a>0 && a<60 then player0: %00000000 %01000000 %10100000 %00100000 %01000000 %00100000 %10100000 %01000000 end if a>60 && a<120 then player0: %00000000 %11100000 %10000000 %10000000 %01000000 %00100000 %10100000 %01000000 end if a>120 && a<240 then player0: %00000000 %11100000 %01000000 %01000000 %01000000 %01000000 %11000000 %01000000 end if a=240 then b=(rand&7) if a=240 && b=0 then goto GAME1_SETUP if a=240 && b=1 then goto GAME2_SETUP if a=240 && b=2 then goto GAME3_SETUP if a=240 && b=3 then goto GAME3_SETUP if a=240 && b=4 then goto GAME4_SETUP if a=240 && b=5 then goto GAME4_SETUP if a=240 && b=6 then goto GAME4_SETUP if a=240 && b=7 then goto GAME4_SETUP drawscreen if pfscore2>255 then pfscore2=255 if switchreset then goto reset goto countdown rem game1 = Sky Diver GAME1_SETUP COLUBK=$00 a=0 b=0 c=0 d=1 e=0 f=0 g=0 h=0 i=0 j=0 k=0 l=0 m=0 n=0 o=0 p=0 q=0 r=0 s=0 t=0 o=0 p=0 q=0 r=0 s=0 t=0 u=0 v=0 w=0 x=0 y=0 pfclear pfscore2 = 255 player1x=255 : player1y=255 player0x=130 : player0y=20 ballx = rand : bally=79 GAME1 scorecolor=$0E ballheight=2 CTRLPF = $30 player0: %00000000 %00001000 %00011000 %01111111 %11111111 %00000011 %00000001 %00000000 end if c=0 then player1: %00100100 %00011000 %00111100 %00011000 %00011000 %00000000 %00000000 %00000000 end if c=1 then player1: %01111110 %01100000 %00000000 %00000000 %00000000 %00000000 %00000000 %00000000 end rem the landing zone logic if ballx<20 then ballx=255 : bally=255 if ballx>130 then ballx=255 : bally=255 if ballx=255 && bally=255 then bally=80 : ballx=rand COLUPF=rand rem timer logic e=e+1 if e=60 then pfscore2 = pfscore2/4 : e=0 pfscorecolor=$0E rem airplane logic if a=0 then player0x=player0x-1 if a=0 && player0x<1 then player0x=135 rem skydiver logic if a=0 && b=0 && joy0fire then b=1 if b=1 then player1x=player0x+4 : player1y=player0y : b=2 if b=2 then player1y=player1y+1 if player1y=80 then b=3 if b=3 then player1y=player1y : c=1 : d=1 if collision(player1,ball) then b=4 : player1y=79 if b=4 then d=0 : player1y=player1y : c=0 if pfscore2=0 && d=1 then pfscore1 = pfscore1/2 : goto countdown if pfscore2=0 && d=0 then score=score+1 : goto countdown NUSIZ0=$05 COLUP0=$0E COLUP1=$0E drawscreen if pfscore2>255 then pfscore2=255 if pfscore1=0 then goto gameover if switchreset then goto reset goto GAME1 rem William Tell GAME2_SETUP COLUBK=$00 a=0 b=0 c=0 d=1 e=0 f=0 g=0 h=0 i=0 j=0 k=0 l=0 m=0 n=0 o=0 p=0 q=0 r=0 s=0 t=0 o=0 p=0 q=0 r=0 s=0 t=0 u=0 v=0 w=0 x=0 y=0 ballheight=0 pfclear pfscore2 = 255 player1x=120 : player1y=10 player0x=20 : player0y=65 ballx = 85 : bally=20 rem bow & arrow GAME2 CTRLPF = $30 COLUP0=$0E scorecolor=$0E COLUPF=$0E COLUP1=$0E player0: %00000110 %00001010 %00010010 %00010010 %00010010 %00010010 %00001010 %00000110 end if a=0 then player1: %00100100 %00011000 %00111100 %00011000 %00011000 %00000000 %00000000 %00000000 end if a=1 then player1: %01111110 %01101000 %00001000 %00001000 %00000000 %00000000 %00000000 %00000000 end if a=1 then REFP1=8 drawscreen if pfscore2>255 then pfscore2=255 if b=0 then ballx=player0x+4 : bally=player0y-4 if c=0 then player1y=player1y+1 if b=0 && joy0fire then b=1 if b=1 then ballx=ballx+3 if b=1 && ballx>135 then ballx=255 : bally=255 : d=1 : b=2 if collision(ball,player1) then b=2 : ballx=255 : bally=255 : a=1 : d=0 : c=1 if c=0 && player1y>90 then player1y=0 CTRLPF = $30 rem timer logic e=e+1 if e=60 then pfscore2 = pfscore2/4 : e=0 pfscorecolor=$0E if pfscore2=0 && d=1 then pfscore1 = pfscore1/2 : goto countdown if pfscore2=0 && d=0 then score=score+1 : goto countdown if b=0 && joy0up && player0y>20 then player0y=player0y-1 if b=0 && joy0down && player0y<80 then player0y=player0y+1 if pfscore1=0 then goto gameover if switchreset then goto reset goto GAME2 rem find me GAME3_SETUP COLUBK=$00 a=0 b=0 c=0 d=1 e=0 f=0 g=0 h=0 i=0 j=0 k=0 l=0 m=0 n=0 o=0 p=0 q=0 r=0 s=0 t=0 o=0 p=0 q=0 r=0 s=0 t=0 u=0 v=0 w=0 x=0 y=0 pfclear pfscore2 = 255 player0x=rand : player0y=rand player1x=75 : player1y=80 ballx = 255 : bally=255 game3 COLUP1=$2E COLUP0=$00 NUSIZ1=$07 player1: %01111110 %11111111 %11111111 %11111111 %11111111 %11111111 %11111111 %11111111 %11111111 %11111111 %11111111 %11111111 %01111110 end player0: %10100101 %10100101 %10011111 %01111110 %00111101 %00011001 %01111101 %01111010 %00101010 %00011100 %00000000 %00000000 end NUSIZ0=$05 drawscreen if pfscore2>255 then pfscore2=255 if player1x<20 then player1x=20 if player1x>128 then player1x=128 if player1y>80 then player1y=80 if player1y<20 then player1y=20 if player0x<20 then player0x=255 : player0y=255 if player0x>130 then player0x=255 : player0y=255 if player0y<20 then player0x=255 : player0y=255 if player0y>80 then player0x=255 : player0y=255 if player0x=255 && player0y=255 then player0y=rand : player0x=rand if g=0 && joy0up then player1y=player1y-2 if g=0 && joy0down then player1y=player1y+2 if g=0 && joy0left then player1x=player1x-2 if g=0 && joy0right then player1x=player1x+2 rem timer logic e=e+1 if e=60 then pfscore2 = pfscore2/4 : e=0 pfscorecolor=$0E if pfscore2=0 && d=1 then pfscore1 = pfscore1/2 : goto countdown if pfscore2=0 && d=0 then score=score+1 : goto countdown if collision(player1,player0) then d=0 : g=1 : COLUBK=$26 if pfscore1=0 then goto gameover if switchreset then goto reset goto game3 GAME4_SETUP COLUBK=$00 a=0 b=0 c=0 d=1 e=0 f=0 g=0 h=0 i=0 j=0 k=0 l=0 m=0 n=0 o=0 p=0 q=0 r=0 s=0 t=0 o=0 p=0 q=0 r=0 s=0 t=0 u=0 v=0 w=0 x=0 y=0 pfclear pfscore2 = 255 player0x=75 : player0y=80 player1x=20 : player1y=50 ballx = 255 : bally=255 rem crab game4 player0: %10000100 %01000010 %11111111 %01111110 %10011001 %11000011 %10000001 %11000011 end player1: %00000000 %00000000 %10001100 %11011110 %01111111 %11011010 %10001100 %00000000 end if a=0 then REFP0=0 if a=1 then REFP0=8 COLUP1=$BE rem fish a.i if r=0 then REFP1=0 if r=1 then REFP1=8 if r=0 then player1x=player1x+1 if player1x=130 then r=1 if r=1 then player1x=player1x-1 if player1x=20 then r=0 COLUP0=$33 rem crab animation b=b+1 if b=30 then a=a+1 : b=0 if a=2 then a=0 rem timer logic e=e+1 if e=60 then pfscore2 = pfscore2/4 : e=0 pfscorecolor=$0E drawscreen if pfscore2>255 then pfscore2=255 if pfscore2=0 && d=1 then pfscore1 = pfscore1/2 : goto countdown if pfscore2=0 && d=0 then score=score+1 : goto countdown if p=0 && joy0right then player0x=player0x+1 if p=0 && joy0left then player0x=player0x-1 rem catch fish if collision(player0,player1) then d=0 : r=2 if r=2 then player1x=player0x : player1y=player0y-8 if player0x<20 then player0x=20 if player0x>130 then player0x=130 rem jump mechanic if p=0 && joy0fire then p=1 if p=1 then player0y=player0y-1 if p=1 && player0y=50 then p=2 if p=2 then player0y=player0y+1 if p=2 && player0y=80 then p=0 if pfscore1=0 then goto gameover if switchreset then goto reset goto game4 gameover pfclear player0x=255 : player0y=255 player1x=255 : player1y=255 ballx=255 : bally=255 scorecolor=rand if switchreset then goto reset drawscreen pfscorecolor=$00 goto gameover Edited September 7, 2016 by Captain Spazer Quote Link to comment Share on other sites More sharing options...
+SpiceWare Posted September 7, 2016 Share Posted September 7, 2016 You're more likely to get help if you post your code as an attachment. Click on More Reply Options and you'll find the options for attachments below the text box. Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted September 7, 2016 Share Posted September 7, 2016 Did you mean for pfscore2 to only last for 4 seconds instead of 8? Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted September 8, 2016 Share Posted September 8, 2016 I think I figured it out. You are using "CTRLPF = $30" in multiple places. Change them to "CTRLPF = $31" and things should go back to normal. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.