Assign two keys in a variable

What do you use to assign two different keys in one variable? For example I want to make this character jump using spacebar, but I also want to make it jump using enter key. And also turn it back to its idle animation? So far Im using the code pc. event

Hi @churiboii!

You can do something like below in the update function of your script.

// update function
if (this.app.keyboard.wasPressed(pc.KEY_SPACE) || this.app.keyboard.wasPressed(pc.KEY_ENTER)) {
    // jump code
}
2 Likes

Yay that worked. Thank you!

1 Like