Page 1 of 1

How to use @KeyPress directly in a ZExpression?

Posted: Fri Apr 02, 2021 6:16 pm
by Ats
Hi, I'm cleaning my code a bit and I'm wondering if I can use the component KeyPress directly in a ZExpression with @KeyPress.
If yes, how do I handle the OnPressed state?
Thanks

Re: How to use @KeyPress directly in a ZExpression?

Posted: Sat Apr 03, 2021 10:47 am
by Kjell
Hi Ats,
Ats wrote: Fri Apr 02, 2021 6:16 pmI'm wondering if I can use the component KeyPress directly in a ZExpression with @KeyPress.
That's not possible no. However, even if it were possible i'd instead recommend handling all your inputs ( keyboard / mouse / joystick / touch ) at the start of each frame and storing the results in one or more arrays. Then you can use those arrays from anywhere in your code .. or if you prefer you could wrap access to them in a number of descriptive functions.

I'd be more than happy to provide a example, but i'm not exactly sure what your particular requirements are.

K

Re: How to use @KeyPress directly in a ZExpression?

Posted: Mon Apr 05, 2021 5:58 pm
by Ats
Oh, all right.
Thanks for the tips. This is more or less what I already do, but I was planing on cleaning all those Condition and KeyPress components, but if it isn't possible, I won't touch it, it's working :wink: