Increment by 1 when clicked, or by 5 every half second of held down - HOW?!

Phraustdesign

  • Posts: 7
So this has eluded me for awhile now - and I feel it is simple - and I’m making it too difficult.

I have an actor button that when pressed increments an attribute value by 1. However I would like it to have another function - if the button is held down it will begin to increment the value by 5 or 10 every half second until the button is released.

So a click increments 1, a long press increments 5 or 10 every .5 seconds until released.

How can this be easily coded?

Thanks in advance, everyone!

Luyren

  • *
  • Posts: 2703
Video on manual timers: https://youtu.be/8A3mmm32l6g
Use a manual timer that increments when the control is held down. Once it reaches your desired time to start the fast values, start another manual timer to increment your desired value by 5 or 10 or whatever you want. Reset all timers when the key is released.
My Stencyl resources are available here: https://luyren.itch.io/
Cutscenes, RPG Elements, Particles, Map System and many more.
Twitter