I have read though a a few articles dealing with this however after attempting to implement a few, a always get the same issue,
quick note: This Is Home Work
Your problem is that XNA defaults to a 60Hz loop so if your game is clocking fast enough then you're checking for keypresses every 16 milliseconds. That gives you a veeery small window in which to hit both keys - if the two keys go down more than about 10 milliseconds apart, then they'll probably end up in two separate update loops and thus get counted as single keypresses rather than combo moves. With human reaction times of around 150-300ms, you're well within the inaccuracy you'll get in human inputs.
I'd probably look at using an input buffer; something like a List
of KeyValuePair
. Each time round the loop you add the buttons currently being pressed to the buffer along with the current time, remove anything where the time is older than a certain timespan, and then check whether the contents of the buffer matches any combo moves. This allows for instantaneous combos as well as sequential ones (for example, A, A, Left+B
would work). You might need to look at some way of cancelling any moves triggered by the single keypresses in the meantime - if you recognise a combo of left, jump&punch
then you'll want to somehow stop them from jumping and punching and instead do the flying uppercut that the combo triggers.
As for the light/heavy keypress, I don't think this is possible in the way you're thinking of - computer keyboards are pretty simple devices; the buttons are simple on/off units with no info about pressure or speed. You could look at how far apart the keypresses are - if you use the buffer approach described, then you could use the times stored with the keypresses to get the time between presses. If that time is longer than a certain interval, you use the weaker or slower move.