Key Pressed not Firing

  • What could be going on? Could this be why when I had two conditions, On Key Pressed and something is visible, it wasn't working?

    Key Down works. But testing in Chrome, On Key Pressed doens't work. It's a simply On Key press go to Layout. But it doesn't work. On Key Pressed isn't doing anything. And no, its not on the keypad, so Numlock is not involved.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's hard to tell without seeing your code.

  • If I'm doing something wrong please let me know. I tested in Firefox too and it's not working.

    On Key Pressed > Go to Layout is not working.

    On Key Pressed > Any Action is not working at all.

    On Key Down works, but the action is done once. Why is key pressed not working? It's One Condition and one Action. that's all. why would it not work?

  • So "On key pressed" is the only condition and it's not inside some other event like "Every X seconds"?

    Then it should work.

    Do you use TextBox? When cursor is in the TextBox, some keyboard events may not work.

    If nothing helps, please share your capx.

  • Actually, it does involve Text Boxes. Not ones you type in, but the ones that just have text in them. Could that be whats messing it up? The Key press isn't really interacting with them though.

  • Nope, thats not it.

    I tried it with setting a variable to 0 and that worked just fine. So I'm guessing on Key Pressed can't make Invisible or destroy an object if that object is involved with a Variable. Why it wont go to another layout i have no idea.

    But as soon as I did set variable to 0 it worked. Even On Key Pressed should still be able to work with Objects that are involved with Variables. Because the button press is overriding the Variable, modifying an object that's involved with a variable.

    If a Variable has caused Objects to do something, then those can't be modified. Even if a Variable triggers Objects and another Variable, and that Varible is affecting other objects. Basically if a Variable has caused something, that Variable has to be changed. Theres no way, at least with Key Pressed, to make something Visible to become Invisible, move stuff, or destroy anything. If the Variable is still in effect then what it's doing will hold true.

    The only thing that worked was having Key Pressed change the Variable to zero. Nothing else was working.

  • I don't really understand what you mean. If you share your project or a screenshot of your events, I may be able to explain what's going on.

  • I don't really understand what you mean. If you share your project or a screenshot of your events, I may be able to explain what's going on.

    I was able to figure it out I had a chain of variables set. Variable 1 = X and Variable 2 = Y. I was trying to change something that was dependent on Variable 2. Because Variable 2 still equaled Y, no other code could affect the objects that depended on Variable 2.

    A Variable = Y. Because how the objects were depended on that Variable 2 = Y (objects are a certain way.) I couldn't change those objects because they stayed the way they were because Variable 2 = Y.

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