-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add a "pressOrRepeat" choice for event handlers? #3288
Comments
We kind of have this -- in Here's an example: https://makecode.com/_Vvuasy3UXLwD |
That is useful, but I think that's not quite the same thing. If you want to use buttons for something like cursor control or menu entries, having a nonzero repeat delay is nice since it allows for precise single movements. Forcing the repeat delay to zero wouldn't work well for that use case. |
Ah, those are two distinct values; delay is 'how long until it triggers the first time', and interval is 'how long does it wait between triggers of the event' |
Yes, but unless I'm misunderstanding it, the current sequence is:
That means it's possible to separately configure delay time and interval time, but if you want to have two distinct time values for more precise input, with a longer delay time after the first press, you still need to add separate event handlers for both onPress and onRepeat. Setting the delay time to zero is a workaround if you want to use a single fixed repeat interval, but then you lose the ability to have a longer delay after the first press. I think configuring the timing is a separate issue from needing distinct event handlers for first press vs repeated press. Or am I missing something? |
Ah, so you're looking for
I see, fair enough |
Not quite, I mean this:
So an application that wants to take different actions for first press vs repeated press can use the current separate handlers to do so, but if it wants to do the same action for each, it just uses the proposed new If I remember right, key events in other systems typically do have a single event that's triggered for both the first and repeated key presses, so I think it would be natural to have this in Arcade also. |
Is your feature request related to a problem? Please describe.
Currently, there are separate event handler types for "pressed" and "repeat", but it's quite common that the game will want to do the same action on each. The workarounds are to either copy the code, or to wrap it in a function, and both are a bit clunky.
Describe the solution you'd like
Could we get a "onPressOrRepeat" event choice to make this easier?
Additional context
Context: discussion in https://forum.makecode.com/t/a-heart-of-cosines-blocks/6791/3
The text was updated successfully, but these errors were encountered: