KevKelley Posted May 15, 2020 Share Posted May 15, 2020 So I was taking a stab at making some difficulty progression, with one aspect tied to the score. I had it to where if the score hit 500 a bit would change and the counter should speed up and draw pixels quicker. What is odd is that sometimes it happens and then other times the counter pretty much stops. I am not sure if I am overlooking anything. This is the pixel routine temp2 = counter/8 - 5 if !counter & 7 && temp2 < 8 then var31 = dat[temp2] data dat $80, $40, $20, $10, $08, $04, $02, $00 end SKIP_CONVEYOR temp5 = (rand&15)+(rand&2) temp6 = (rand&3)+(rand&3)+4 if e{5} then goto PIXEL_GEN if z{6} then counter = counter +1.0 :goto PIXEL_GEN if !z{6} then counter = counter + 2.0:goto PIXEL_GEN PIXEL_GEN if counter <> 100 then SKIP_PIXEL_GEN pfpixel temp5 temp6 on counter = 0.00 if !d{3} && counter >0 then goto SKIP_STATUS if counter = 0 then statusbarlength=statusbarlength-4 SKIP_STATUS rem conveyor belt SKIP_PIXEL_GEN The check I made is this: if _sc2 =$05 && _sc3 = $00 then z{6}=0 Is it possible that if the timing is right, and the score is met, the counter switches to counter+2.0 and the counter <> 100 condition is never met so it skips the pixel code forever? Quote Link to comment Share on other sites More sharing options...
KevKelley Posted May 15, 2020 Author Share Posted May 15, 2020 I think while typing up my question and rereading the code I think I may have answered my own question. I tried replacing the check with this: if z{6} && _sc2 =$05 && _sc3 = $00 then counter=0.0: z{6}=0 So far I haven't gotten anymore inconsistencies. 1 Quote Link to comment Share on other sites More sharing options...
Lillapojkenpåön Posted May 15, 2020 Share Posted May 15, 2020 If that's exactly how the code looks I think you should move the data table to where you don't fall into it, like after a goto. 1 Quote Link to comment Share on other sites More sharing options...
KevKelley Posted May 15, 2020 Author Share Posted May 15, 2020 So data tables can be anywhere? Quote Link to comment Share on other sites More sharing options...
KevKelley Posted May 15, 2020 Author Share Posted May 15, 2020 I'm guessing when in assembly it knows where to go? Quote Link to comment Share on other sites More sharing options...
bogax Posted May 15, 2020 Share Posted May 15, 2020 (edited) you don't show what counter is presummably its an 8.8 variable if counter is less than 40 then temp2 will be 251 or greater 39/8 = 4 4 - 5 = -1 = 255 a data statement can be anywhere in the same bank bB normally inserts a jump (like a goto) around each data statement if you use the noinlinedata optimization it will omit the jumps and you have to put the data statement out of the code path (eg after a goto or a return) Edited May 16, 2020 by bogax clarification 2 Quote Link to comment Share on other sites More sharing options...
KevKelley Posted May 16, 2020 Author Share Posted May 16, 2020 Whoops. Yeah. counter =x.y Thanks. I'll have to play around with this. Quote Link to comment Share on other sites More sharing options...
bogax Posted May 16, 2020 Share Posted May 16, 2020 temp5 = (rand&15)+(rand&2) will produce a number 0..15 or 17 temp6 = (rand&3)+(rand&3)+4 will produce a number 4..10 1 Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted May 16, 2020 Share Posted May 16, 2020 3 hours ago, KevKelley said: So data tables can be anywhere? I just did a test with data in the main loop and outside of the main loop and both compiled. In other BASIC-style programs that I used, if I remember correctly, the program would crash if the flow of the program ran over normal data. I'm still going to keep all of my normal data outside of the main loop so I can find it quicker. 1 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.