Jump to content
IGNORED

Best way to make a thermometer bar


Karl G

Recommended Posts

Does anyone have a suggestion for a good way to implement a thermometer-style bar (in this case - a fuel gage) using 7800basic? I can think of a couple of ways, but neither seems ideal:

 

  • Use a different sprite for every state of the thermometer bar. This would work fine, but it requires a huge number of sprites, and seems wasteful.
  • Plot the appropriate number of characters. This would be less wasteful, but would require that changes be in increments of the character width.

 

334137250_ScreenShot2020-09-05at2_57_54PM.thumb.png.dd41203ded624cbd55ee233e47ef9bda.png

Link to comment
Share on other sites

No image in your post, but I get what you're after. Characters is pretty common for fuel gauge implementations. If you want it to be finer grained, you can define characters so the last bit of the fuel bar can be 1/4, 1/2, or 3/4 of a character.

 

I'd use plotchars with a ram buffer for this. I did exactly this for the LED bars in the 7800basic example provided with the XMYM tracker...

 

 

  • Thanks 1
Link to comment
Share on other sites

7ix is currently configured to use indirect mode for its timer bar. With single-byte characters, you need 9 characters for single-pixel granularity, one for blank and one for each of 8 possible endpoints. At any moment, display some number of full characters, possibly one partially-filled character, and the rest empty.

 

Another possibility (which I may eventually switch to) is to use direct mode with the bitmap in RAM, and then just update that bitmap (one byte per line per change) as needed. I’m confident this is feasible in assembly, not sure about 7800basic.

 

  • Like 2
Link to comment
Share on other sites

There's another way to do it with indirect graphics and that's by using a separate object drawn on top to slide over the tiles and then change the tiles when it moves far enough.

For example if your meter was at 29 of pixels 64 you'd have 3 tiles (assuming 8*8) covering 0 to 24, and then you'd have a second 8*8 object overlapping it that covers pixels 21 to 29. To have values less than 8 it would then need to be masked on the left with another object on top of that, preferably something that would already be drawn in that spot.

 

I'm not describing it very well but if you look at the growing vines or the moving block platforms in a couple of the castle levels of Super Mario World you'll see what I mean.

 

  • Like 2
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...