How do i avoid desync while making a rhythm game? #1125
-
I'm making a patapon fangame but the beat desyncs, i tried using the timer but it still doesn't work, is there a way to make precise rhythm? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 25 replies
-
I suggest using the DeltaTime extension |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
You didn't answer him on how to make music sync with gameplay, which is what he was asking in the first place. |
Beta Was this translation helpful? Give feedback.
-
Delta time isn't really meant to solve this. The best you're going to get is using "days since 2000" to get the most precise timer available in Scratch (multiply by 86400 to get seconds; you could also just use normal timer blocks). Record the start time and just calculate the current time in the song from that. Instead of doing things like "move the note forward [x] pixels per frame" (will lead to imprecision), you would use some math to figure out exactly where each note is supposed to be displayed at the current time. That's the best you can get. |
Beta Was this translation helpful? Give feedback.
Well, there's multiple ways to use DeltaTime, I personally use this:
I'm sure your favorite browser can help you find more effective ways.