Originally Posted by
joeprogrammer
I would guess that the code would do something like this:
Code:
if(keydown['A'] && keydown['B']) {
do_cool_fighting_move();
}
Of course you'd have to do extra checking when you check the other keys to make sure you don't do 2 things at once.
In most fighting games you hit a series of buttons in a row and not all at once to do a special move which is alot more complicated I think
You would probably need an arrayof ints to store how long ago the button was hit, this will allow us not only to see if the button was hit a certain number of cycles ago, but also check to make sure the buttons were hit in the proper sequence
then then when we do our input checking...
Code:
if(Keys[VK_UP])
{
KeyTime[VK_UP] = 0;
}
then each cycle:
Code:
if(PastKeys[VK_UP] != -1)
{
KeyTime[VK_UP]++;
}
if(KeyTime[VK_UP] > 50)
{
KeyTime[VK_UP] = -1;
}
let's just act like 50 was what we chose to be the max number of cycles in between button hits if the player was trying to launch a combo, the smaller it gets the harder it would be to pull off the combo, and the bigger the easier
Code:
if(PastKeys[VK_UP] != -1 && KeyTime[VK_LEFT] < KeyTime[VK_UP] && KeyTime['A'] < KeyTime[VK_LEFT)
{
FireBall();
}
so if i hit up then left then 'a' my character would launch a fire ball and kill yours