IsKeyPressed vs IsKeyDown : Execution time

0 favourites
  • 3 posts
From the Asset Store
An educational game for Times Table. An easy to use template for developers to build larger games
  • 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 can�t 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 can�t 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!

  • 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

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • You can have IsKeyDown to act like IsKeyPRessed by using Trigger once through.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)