Good morning / afternoon / evening for the people reading the question..
I started using Godot since a couple days, gone through some tutorials and tried making a rhythm game, where you interact with the application at a specific time. Used tweens to animate rotation 360 degrees per one beat (i.e. 60 BPM =360 deg/1 sec , 120 BPM = 360 deg/0.5 sec, N BPM = 360 deg / 60/N). By making the tweens interpolate property of the sprite's rotation determined by BPM, the function itself seemed to work out well..
Here's where the main problems initiates Since rhythm games are strict with beats: lags and its inconsistency affect the play a lot, which is now happening. Everything works with proper equations theoretically, but probably reality hates me to apply those logics..
I would be so happy if I can get helped :D
Here is the code how I found the inconsistency:
BPM Tick function:
func _process(delta):
if Hand.rotation_degrees == float(0):
$Hand/SFX.play();
Function: Whenever the degree is 0, play a sound effect allocated at $Hand/SFX
func _startAnimation(bpm):
tween.interpolate_property(Hand, "rotation_degrees", Hand.rotation_degrees, Hand.rotation_degrees + 360, float(time), Tween.TRANS_LINEAR, Tween.EASE_IN)
tween.start();
How it works