IsKeyPressed vs IsKeyDown : Execution time

Discussion and feedback on Construct 2

Post » Thu Feb 06, 2014 3:46 pm

Hi,

I am concerned about the execution time of the use of IsKeyDown instead of triggered IsKeyPressed. Is there any noticable differences ?

In fact, this is because i designed a function for gamepad support that enable me to detect either if he moved the axis out of the deadzone in 4 directions or a button press since it seem that the axis index registered is the same for left and right or up and down so i think the only way is to compare axis value to detect this (correct me if i am wrong..). Doing this i cant use triggered events to detect a gamepad key press.. (I am comparing against a keys mapping dictionnary and he could have set jump to the second analog stick as a example and if he mapped example right analog i must be able to detect it with my function before any other button key press so that is why i cant use a triggered event otherwise i would have to make an event check for axis detection AND an event check which is a triggered event that check for a button press for same action i want to do).

Any ideas ?

Thanks!
B
16
S
5
G
1
Posts: 190
Reputation: 2,489

Post » Thu Feb 06, 2014 6:23 pm

To answer your first question, if IsKeyDown is true, then actions and subevents of it will be run every tick that it is true. IsKeyPressed is only activated once for the entire time that the key is down. Other than that they should act the same. Both may even be first activated on the same System.tickcount, but I haven't tested this yet.

I haven't experimented with the Gamepad.axis yet to know how that works. Have you already checked out the manual entry for Gamepad
B
20
S
4
G
1
Posts: 185
Reputation: 2,563

Post » Fri Feb 07, 2014 12:12 am

You can have IsKeyDown to act like IsKeyPRessed by using Trigger once through.
B
16
S
5
G
1
Posts: 190
Reputation: 2,489


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 14 guests