I've seen some action fighting games and really impress with their technique of combine keys to generate different moves. So do those techniques require time period or something like that?
Printable View
I've seen some action fighting games and really impress with their technique of combine keys to generate different moves. So do those techniques require time period or something like that?
I would guess that the code would do something like this:
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.Code:if(keydown['A'] && keydown['B']) {
do_cool_fighting_move();
}
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 thinkQuote:
Originally Posted by joeprogrammer
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:int KeyTime[256];
then each cycle:Code:if(Keys[VK_UP])
{
KeyTime[VK_UP] = 0;
}
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 easierCode:if(PastKeys[VK_UP] != -1)
{
KeyTime[VK_UP]++;
}
if(KeyTime[VK_UP] > 50)
{
KeyTime[VK_UP] = -1;
}
so if i hit up then left then 'a' my character would launch a fire ball and kill yours :mad:Code:if(PastKeys[VK_UP] != -1 && KeyTime[VK_LEFT] < KeyTime[VK_UP] && KeyTime['A'] < KeyTime[VK_LEFT)
{
FireBall();
}
Thanks guys. Sure it does look complicated.