Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I have a game where I need to perform an action by pressing U and K at the same time, but I also want it to be accomplished by only using one key, because pressing both at the same time ties up your hand a bit.

How would I accomplish this?

share|improve this question
3  
Maybe you can walk us through the steps on what you want? It's not really clear to me at least. The player needs to press U and K? What does "using one key to input the animation" mean? –  Byte56 Jun 15 '13 at 0:10
    
I need to press U and K at the same time to basically. U = block, K = power, but if you press both at the same time and hold them, then you do a power block in the game. It ties up your hands a bit, so I want to just press one key to function like U+K. I want to be able to use something like "O" and it function like I pressed U and K. –  DWOplayer Jun 15 '13 at 1:19
add comment

closed as not a real question by Nicol Bolas, msell, Sean Middleditch, Laurent Couvidou, Trevor Powell Jun 19 '13 at 9:34

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

This is pretty simple. Basically, you just have another key call the same function as U+K does.

if((keyDown('U') && keyDown('K')) || keyDown('O'))
    doPowerBlock();

Basically that's saying if the U key AND the K key are pressed, OR the O key, do the action. Or depending on how you have things arranged, you could do something like:

if((keyDown('U'))
    doBlock();

if((keyDown('K'))
    doPower();

if((keyDown('O')) {
    doBlock();
    doPower();
}
share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.