It seemed simple. All _kbhit() did was return a 1 if there was a key in the keyboard queue, and a 0 of not. _getch() just grabs the next character in the queue. The problem I was having was I replaced the BIOS keyboard queue with Allegro's to get things functional. However, the new keyboard queue holds MUCH more than just what key was pressed. It also holds, in order, the key down and key up events. So just because something is waiting in the queue, doen't necessarily mean it's a character. I flailed with this for a while, making implementations of _kbhit() and _getch() that worked "good enough" while at the same time goofing up my keyboard queue. I got it to work in my test unit, and then when it was in the game, failed massively.
I was programming on accident.
For those who don't know, this is when you code without any idea what you are doing in hopes that it works. The problem is that if you do this, and the program breaks later, you have no idea what's wrong or how to fix it. It was also frustrating myself as I couldn't seem to get two fairly simple functions to work properly. I was pointed in the right direction with some help on a forum. Turns out I wasn't follow my logic properly. The cool thing was as long as I showed off my example code and made it obvious I was making an effort, people were bending over backwards to help and explain what I was doing wrong. Thumbs up!
The old paperdoll, layered in GIMP. |
Moving on I'm now working on the paper dolls that represent the commanders in the game. I'm fixing up the poses and character designs, but keeping the uniforms mostly the same. I'll do some initial character designs on my own, but may need backup if it's a little too time consuming.
No comments:
Post a Comment