Hey,
so I have what you could call a “cutscene” timed with some music. Simply put a character moves down the screen. And what I want is that the character reaches the bottom of the screen exactly when the music stops.
I use a variable framerate and add “*FP.elapsed” to the movement code so it is time-dependent.
And this works mostly well: The character stops perfectly with the music. But some times the character takes a little longer than usualy and the music stops prior to their arrival.
I though it might be an issue with the framerate and tried setting it to something rather low (~10fps). The code is still the same as with 60fps but now the character is so far out of sync that the music stops about a minute before they reach the bottom.
I made a quick and simple test in a new project:
super(800, 600, 60, false);
counter += FP.elapsed;
trace(counter);
And then I timed when the in-game timer and my watch got to 3 seconds. And with 60fps it was pretty much the same.
But the lower the framerate (mostly notable below 20fps) the longer it took for one second to pass in-game where 3 real-life seconds would equal double or more in in-game time. (This also happens with Alarm Tweens so it’s not just FP.elapsed)
Now long story short: Is this an issue with timing in FlashPunk or is this just how it works and low framerates mess with exact timing. Or am I doing something wrong?
If this is not a bug or mistake. Is there any other way to get excact timing so I can sync up my music with the cutscene at any framerate?
(I know that the framerate shouldn’t be that low anyway, but my game can be a bit performance-heavy at times and I fear that it will mess the cutscenes up if there are some framerate drops)