Trick combo help js

I was wondering how you add to keys at the same time to do a trick. Right now when I push ‘x’ my skateboarder does an Airwalk trick but how could do something like ‘x’ and ‘z’ to do different trick. Pretend I already type the functions.

if(Input.GetKeyDown(KeyCode.X))
airwalk();

^^^^^Is what I have for my trick. I’m trying to do something like this:

if(Input.GetKeyDown(KeyCode.X KeyCode.Z))
backflip();

Hi caseyboundless,

You’ve almost got it. Try this:

if(Input.GetKey(KeyCode.X)  Input.GetKey(KeyCode.Z)) 
    backflip();

Note that GetKeyDown() tests if the key was pressed down at exactly this frame. You won’t want to use that here, because the player will have to be really good at pressing both keys at exactly the same time! GetKey(), on the other hand, returns true if the key is down right now, but maybe it went down a few frames ago.

Keep in mind that with the code I’ve posted, backflip() will now be called every frame that both keys are down, which will probably cause you some problems. Now you’ll need to write a little code to prevent it from being called a lot in a short period of time. :slight_smile:

Thank trumble could you show me the code to prevent the short period. I’m new to programming :slight_smile: