Jump to content
IGNORED

Irritating statusbarlength


atari2600land

Recommended Posts

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.

Link to comment
Share on other sites

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 by Robert M
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...