On Key Press / Down / Up - User input option for keyCode

Not sure if this has been mentioned, but would it be feasible to have an input under the above mentioned behaviours that allows a user to input the keyCode (or associated key) that (s)he wants to use and attach an action to it. It would help non Javascript savvy users. :wink:

e.g

6 Likes

Thanks, I do agree this is missing. In general the problem is that users will likely want to have different keys do different actions, and not just one key. But we’ve since solved a way to do multiple actions in response to a general hander with the Custom Behavior UI, so there’s an easier way forward now.

Hello!

Is the function still available in the latest Hype app? I can’t seem to find the key Code input field.

The screenshot above was a mockup for the feature. It isn’t implemented; the way to do filter by a keyCode is to use a Run JavaScript action and then conditionalize with code based on the event.keyCode field. example:

if (event.keyCode == 37) { // left
    hypeDocument.showSceneNamed('Unititled Scene2 ', hypeDocument.kSceneTransitionCrossfade, 1.1);
}
1 Like

Ahh! I see. Thanks!

Are tutorial on creating platform games on Hype?

Sometimes you’ll find crazy members like myself that like to mess with the UI when trying to explain a new feature that we’d think would be of benefit. :stuck_out_tongue:

As far as I’m aware, there isn’t any “tutorials” here in the forum specific to “platform gaming”. There might be something out there in web land.

There are however some examples by some members that incorporate game playing inside of Hype. So, plenty of examples to look through but not a “tutorial” as such. Try the search in the top right :point_up:

1 Like

Run the action where in Hype? Thought: in the scene itself at key press?

Yes, using the On Key Down, On Key Up, or On Key Press events in the Scene Inspector/Layout Inspector. Those are the events that will have the event.keyCode filled in.

There’s this…


…and the upcoming printed addition of “A Book About Hype” is on the way.

The “Jump” template might help you out too. There are a lot of key events in there. If you need to know the key codes, Keen can help too.

1 Like

So after a bit of playing around here is where I landed.

1 Like

That works pretty well! (And I love the stripes/colors on the pages btw)