Would there be a way to detect a range of when a player can press a button?

So, with a rhythm game, I want to detect if the player presses the “punch” button within a range of like a quarter of a second. I have an idea for it, but unsure if it will work. For starters, can you detect if the seconds into game is between two decimals? Then I’ll explain more when this first question is answered.

You’d probably need blocks, but it would probably be something like this:

new property
property name: "Time Elapsed"
[make the property update the time elapsed, 
the greater precision the better]
property type: number

new overlay(?)
type: button
text: "Punch"
new block
    if abs([get property: "Time Elapsed"] - {time that the player should press a button}) < {time range for perfect}
    broadcast channel on: "Perfect"
    elif ... < {time range for good}
    broadcast channel on: "Good"
    etc.

should work for just one note. Let me know if you have any questions! Just curious, though, how do you plan on implementing music?

3 Likes

For detecting time, you can use a trigger loop with a delay to add a decimal number to “Time Elapsed” on every trigger

When the button is activated, make a trigger that triggers, with a delay of 0.25. Once passed, it deactivates the button.

Hope this helps

I’m not going to use much MUSIC, but honestly I could make a rhythm game for each track. Instead, I’m probably gonna do mainly visual cues and useless device sound effects.

1 Like

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.