How to use @KeyPress directly in a ZExpression?

All topics about ZGameEditor goes here.

Moderator: Moderators

Post Reply
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

How to use @KeyPress directly in a ZExpression?

Post 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
User avatar
Kjell
Posts: 1876
Joined: Sat Feb 23, 2008 11:15 pm

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

Post 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
User avatar
Ats
Posts: 603
Joined: Fri Sep 28, 2012 10:05 am
Contact:

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

Post 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:
Post Reply