How to check if a button is being depressed or held?

Welcome to our brand new Clickteam Community Hub! We hope you will enjoy using the new features, which we will be further expanding in the coming months.

A few features including Passport are unavailable initially whilst we monitor stability of the new platform, we hope to bring these online very soon. Small issues will crop up following the import from our old system, including some message formatting, translation accuracy and other things.

Thank you for your patience whilst we've worked on this and we look forward to more exciting community developments soon!

Clickteam.
  • So I'm trying to check to see if a button is not being held anymore but I don't know how.

    Something to start it is like this: If button 'z' is pressed then change counter to '1'
    but i want to make the character move only when the button is pressed and stop moving when it is not.

    Any help?

    It's for an obstacle course game where holding the button down makes the guy zoom up.

  • First, don't use conters to store data, use object values\strings and flags instead, they are more flexible, and cleaner (and not considered as an object for each value..)
    Counters should only be used to display stuff, not store it... (ofc, when using values, don't forget to rename them, don't have unnamed values like "Alertable Value A")

    To answer your question, it's simple, you can create a flag for your player (a flag is basically a switch that can be turned ON or OFF) and name it however you like

    In events:

    Always:
    - Set Flag to OFF

    Repeat while Z is pressed:
    - Set Flag to ON

    This works because events are read from top to bottom every frame (app loop) one of the last things that is the frame rendered, and due to the always event being before the input check, it would work because in every frame, it would try to turn the flag off, then right after, it checks if the Z button is pressed, if true, it will Set the flag ON

    Note that you can also check for a negated input check by rich clicking on the condition and clicking negate, both methods would work just fine..

    Then you can simply check if the flag is on or off to do what you want to do.

    Btw, it seems like you are new to the engine, please consider learning the basics first, you can start out with the built-in tutorials from Help > Tutorials in Fusion's toolbar

    Game/App developer, artist and a community contributor.
    You can support my work on: Please login to see this link.

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!