Making a rhythm game

I don’t know how to make a precise input time. For example : at (0:20) of the playing song, you should click once or it will be counted as a miss.
If you clicked at (0:19.5) or (0:20.5) for example, it would would count as an almost/ barely.
Also, a flicking input (like the one in Rhythm heaven DS).

Sorry if I was asking for too much.

1 Like

Normally, I’d say use timers, but with sound and music, there’s actually a better way.

Use the “Playing offset of a sound on a channel” (or playing music of a sound on a channel) condition.

I believe the offset is how many milliseconds into the sound/music it is. (It might be seconds. It’s been forever since I poked at it)

So if, say, you want them to click at 0:19.5 (19.5 seconds, or 19500 milliseconds), you’d set up the condition of
“Playing Offset 19500 of sound on Channel 19500”.

At a high level: To simplify things, I’d probably condense all of your “perfect” hits into one event, and all of your “good” hits into one event, etc.

You’d do this by nesting all of the various “Playing offset of a sound on channel” conditions into an “or” statement on the conditions, and trigger once. For the action, you’d set a scene “perfecthit” variable to 1. You would ALSO set “goodhit” and “miss” to 0.

You’d have a separate event like this for “goodhit”, do the same (set up your timing conditions into an OR statement, set goodhit to 1, set perfecthit to 0, set miss to 0. Make sure you have trigger once.

You’d then have a miss event that has all of the above conditions in the two OR statements (your perfect/good timings) into 1 condition (but no or), then invert them, so you’re basically saying 'If not any of the perfect/good timing", and set miss to 1 with the others to 0. Make sure you have trigger once.

Then you’d just have a separate event that says “if button clicked/touched/whatever” as the condition, with 3 sub events.
“If miss variable = 1 | do whatever for miss”
“if good variable = 1 | do whatever for good”
etc. (All with trigger once)

You may have to adjust some of this, but it should be doable.


Thank you! Really appreciate the explanation.

i did this once in scratch, and the same thing should work here too, but i believe you could just use “If Y Position of (sprite) = (y position)” and then just show the sprite you want.

sorry if it doesnt make sense, been a bit since ive used gdevelop