From a0d99945df4e59bc0e851a5b9a83257726440694 Mon Sep 17 00:00:00 2001
From: Cameron Taylor <cameron.taylor.ninja@gmail.com>
Date: Tue, 17 Nov 2020 18:31:59 -0800
Subject: [PATCH] fix for #12

---
 source/MusicBeatState.hx | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/source/MusicBeatState.hx b/source/MusicBeatState.hx
index 0d9da14a5..23d2b6b91 100644
--- a/source/MusicBeatState.hx
+++ b/source/MusicBeatState.hx
@@ -64,6 +64,13 @@ class MusicBeatState extends FlxUIState
 		totalSteps += 1;
 		lastStep += Conductor.stepCrochet;
 
+		// If the song is at least 3 steps behind
+		if (Conductor.songPosition > lastStep + (Conductor.stepCrochet * 3))
+		{
+			lastStep = Conductor.songPosition;
+			totalSteps = Math.round(lastStep / Conductor.stepCrochet);
+		}
+
 		if (totalSteps % 4 == 0)
 			beatHit();
 	}