+Random Terrain Posted November 17, 2010 Share Posted November 17, 2010 I need to go back through my program to see if I can free up any variables, but I've done that as I went along, so there is a good chance that I'm down to my last variable and I'll probably need it later. Is there a good way, without wasting a variable, to tell if the score has reached the next thousand so the player can get a bonus? Once the thousands spot hits nine, it will go back to zero the next time the player earns another thousand, so that could mess things up if not done right. I reread the section about the score on the bB page, but I'm not sure how to convert the examples to what I need. Is there an easy, big brain way to give the player a bonus every time he or she earns another thousand points? I'm just not smart enough to figure it out. Thanks. Update: I finally got around to making an example for this on the bB page based what on what RevEng posted below: randomterrain.com/atari-2600-memories-batari-basic-commands.html#ex_score_digit_check Quote Link to comment Share on other sites More sharing options...
RevEng Posted November 17, 2010 Share Posted November 17, 2010 (edited) I don't see a way to do it without using memory, but you might be able to get away with using a temp variable if your score addition happens in a fairly compact chunk of the code... dim sc1=score+1 rem ** save the thousands digit without the hundreds digit. rem ** do this right before your score additions routines... temp6=sc1&$f0 rem ** score addition routines happen here. nothing that overwrites rem ** temp5 or temp6 can happen here. That includes "drawscreen". rem ** now check if the thousands digit changed... temp5=sc1&$f0 if temp5<>temp6 then gosub bonuslife ...this assumes that your score addition routine won't ever add more than 1000. If that's not true, you could expand the above routine to also track the ten thousands digit. Edited November 17, 2010 by RevEng 1 Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted November 17, 2010 Author Share Posted November 17, 2010 I don't see a way to do it without using memory, but you might be able to get away with using a temp variable if your score addition happens in a fairly compact chunk of the code... dim sc1=score+1 rem ** save the thousands digit without the hundreds digit. rem ** do this right before your score additions routines... temp6=sc1&$f0 rem ** score addition routines happen here. nothing that overwrites rem ** temp5 or temp6 can happen here. That includes "drawscreen". rem ** now check if the thousands digit changed... temp5=sc1&$f0 if temp5<>temp6 then gosub bonuslife ...this assumes that your score addition routine won't ever add more than 1999. If that's not true, you could fix the above routine by tracking the ten thousands digit also. I use the following, so I changed sc1 to sc2 in your example so it would work: dim sc1=score dim sc2=score+1 dim sc3=score+2 Seems to be working great so far. I tried different values for the score and everything I tried worked perfectly. It's also nice that I don't have to waste a variable. Thanks for the help. There's no way I would have figured that out on my own. Quote Link to comment Share on other sites More sharing options...
RevEng Posted November 17, 2010 Share Posted November 17, 2010 You're welcome... glad to contribute anything to help Seaweed Assault become a reality! Quote Link to comment Share on other sites More sharing options...
+Random Terrain Posted July 17, 2013 Author Share Posted July 17, 2013 I finally got around to making an example for this on the bB page based what on what RevEng posted above: randomterrain.com/atari-2600-memories-batari-basic-commands.html#ex_score_digit_check 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.