+Karl G Posted September 5, 2020 Share Posted September 5, 2020 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. Quote Link to comment Share on other sites More sharing options...
RevEng Posted September 5, 2020 Share Posted September 5, 2020 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... 1 Quote Link to comment Share on other sites More sharing options...
+Pat Brady Posted September 5, 2020 Share Posted September 5, 2020 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. 2 Quote Link to comment Share on other sites More sharing options...
+Karl G Posted September 5, 2020 Author Share Posted September 5, 2020 Thanks! As a side note, is it just me that sees the image in my post, or just RevEng that can't see it? ? Edit: Fixed, I think. Quote Link to comment Share on other sites More sharing options...
+Mitch Posted September 5, 2020 Share Posted September 5, 2020 29 minutes ago, Karl G said: Thanks! As a side note, is it just me that sees the image in my post, or just RevEng that can't see it? ? I get a 404 error for your image. Mitch 1 Quote Link to comment Share on other sites More sharing options...
+SmittyB Posted September 5, 2020 Share Posted September 5, 2020 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. 2 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.