i'm creating a platform, jump-and-run game. is it possible to press 2 buttons together like jump and move forward at the same time?
Absolutely. It wouldn't be much of a gaming platform if you couldn't do that.
Each time a button is pressed, the ButtonDown( button ) function is called. Until it's released and the ButtonUp( button ) function is called, consider that button pressed.
What I usually do is keep an array of booleans to know if the button is pressed (true) or not (false).
-John
Some hardware does not support 2 buttons at a time... I know the compaq 3760's don't.
I think a version of MAME on the PPC had the option of using the direction pad and virtual buttons on the screen, but even then, you couldn't go diagonal since that was two buttons at once.
Or buy one of those add-on joysticks.
The buttons don't send a continuous pulse to let you know they're pressed. They call the ButtonDown() function when they're pressed, and the ButtonUp() function when they're released. It's our job as programmers to know what state they're in. There is no "getbuttonstate" function in PF.
The only way I can see this not working is if the second ButtonDown function isn't called while one of the other buttons is pressed. That would suck, but it would probably exist in less than 5% of the devices out there.
Presto: The IPAQ 36xx and 37xx series do not support this, probably the mostly sold handheld computers out there. You won't get a new button down event on these once another key is pressed.. Since the IPAQs represent more than 5% of the devices out there unfortunately you cannot count on two or more buttons being pressed simultaneously.
Wow. That's just terrible.
Thanks sbl. I didn't know the problem was that widespread.
yup. I'm developing on the Ipaq. damn!! there was a demo a while back. weeboo. no wonder he uses a screen tap to make the character jump.