Possible for multiple button input defines?


Sorry if title is not worded correctly or vague.

Basically, what I want is to basically do this: Input.define(“elastoRight”, Key.SPACE && Key.D)

I want elastoRight to only be true if space AND d is held down at the same time.

Is it possible to do this or will I have to listen to both keys at the same time like: Input.check(Key.D) && Input.check(Key.SPACE)

(David Williams) #2

The documentation leads me to believe it should look like this:

Input.define("elastoRight", Key.SPACE, Key.D)

I don’t have an environment set up to test it, but the docs say:

public static function define(name:String, ... keys):void

Which I found here: http://useflashpunk.net/docs/

Edit: Alternatively, I checked the tutorials on the site, and that is indeed the proper syntax. The input tutorial can be found here: http://useflashpunk.net/basic/keyboard-and-mouse-input.html

Edit #2: I somehow missed the 4th line, my bad. The solution you provided (using two Input.check()s and &&) is what I’ve used in the past, and I don’t believe there’s any other way to do it. I could be wrong, but that’s my experience.