+atari2600land Posted January 22, 2009 Share Posted January 22, 2009 In working on Jack and the Beanstalk, I have a statusbar in level 3 indicating a bonus point timer. What I want to do is once the player exits the level, have the score increase by the length of the status bar multiplied by 4. So, why won't this work? b=statusbarlength*4 score=score+b Instead of working, it gives a score increase significantly less than what it's supposed to be. Quote Link to comment Share on other sites More sharing options...
Robert M Posted January 22, 2009 Share Posted January 22, 2009 (edited) In working on Jack and the Beanstalk, I have a statusbar in level 3 indicating a bonus point timer. What I want to do is once the player exits the level, have the score increase by the length of the status bar multiplied by 4. So, why won't this work? b=statusbarlength*4 score=score+b Instead of working, it gives a score increase significantly less than what it's supposed to be. It doesn't work because the number stored in 'b' is in two's complement format, and the number stored in 'score' is in binary coded decimal format. You need to convert 'b' into binary coded decimal format before you add it to 'score'. I can explain how to do that later today when I have more time, if someone else doesn't do it first. EDIT: On second thought, I think the problem may be truncation of the multiplied value to 8-bits to fit into b. I'll need to examine the problem more later. Edited January 22, 2009 by Robert M Quote Link to comment Share on other sites More sharing options...
MausGames Posted January 22, 2009 Share Posted January 22, 2009 Since that doesn't work, you could just animate it in real-time, by subtracting 1 from the statusbarlength in a loop. Soarmething like scoreup If statusbarlength > 0 then statusbarlength = statusbarlength - 1 : score = score + 4 else goto done goto scoreup Would give you the same result. Quote Link to comment Share on other sites More sharing options...
+batari Posted January 22, 2009 Share Posted January 22, 2009 I agree with Maus, but I would put a drawscreen in the loop, as I'd assume the score adding happens at the end of a level, so this will show the score adding up as the bar counts down (which lots of games do.) Also I'd add a sound. Something like this: scoreup if statusbarlength > 0 then statusbarlength = statusbarlength - 1 : score = score + 4 else goto done drawscreen AUDV0=15 AUDC0=4 AUDF0=statusbarlength/8 goto scoreup done AUDV0=0 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.