Jump to content
  • entries
    4,998
  • comments
    2,729
  • views
    1,813,605

Testing the battery.


atari2600land

222 views

So I was reading the Nester's Funky Bowling manual trying to come up with something to add to the Burgers game. I'm going to add the Virtual Boy testing screens when I'm finished, but something in the meantime. I came across the part where it talks about an icon coming up when the battery is low. Seemed easy enough, but it turned into a huge production. But I think I have it done now thanks to the Discord people. Unfortunately, there is no function in Mednafen to simulate a low battery, so I had to do something involving making a key press make the icon come on. (You have to design your own battery icon. It's not there.) And then once I had that figured out, I deleted the two lines that made the key press activate the battery icon. In my game, the battery icon will come on to the right of the score (or lives if you are brave enough to start a game when the battery is low ;))

 

I know most of you probably aren't going to program Virtual Boy with C any time soon, but here's the magic code:


void fff()
{
    u16 pad_bits = vbReadPad();
    if ((pad_bits & 1) == 1) batttest=1;
    if ((pad_bits & 1) != 1) batttest=0;
}

If I just call that in my game, it should work. I declared "batttest" as an "int" variable. And I put the battery icon as part of the alphabet, so if I tell the VB to print an exclamation point, the battery icon will show up. I use the SNES AC adapter to power my Virtual Boy, so unless I get 6 AA batteries out, play the Virtual Boy for a few hours until the batteries get low then it'd be kind of hard for me to test it. But the logic looks correct, so I think it will work.

 

I am waiting for someone else to design a better milkshake sprite, that will be interesting.

0 Comments


Recommended Comments

There are no comments to display.

Guest
Add a comment...

×   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...