EDIT: As dop pointed out correctly, deltatime is working. However, stopping the sprite with tilemovement causes the issue as it stops being framerate independant. I require this stopping. If anyone has an idea how to keep the stopping while still ensuring framerate independance, please let me know!
For reference on dt: construct.net/en/tutorials/delta-time-framerate-71
Ok so my setup is as following. I have the player object moving via the tile movement behavior. Every step/tile moved, I disable the input and go into a (recursive) function. Once it ran through, I enable the input again.
This leads to a stuttery movement, especially on lower framerates, so I have the player sprite move separately. It´s supposed to closely follow the player object slightly slower and use the brief pause in movement to catch up to the object. Generally this works fine, but it isn´t framerate independent despite the use of deltatime.
The result is that the player object and the sprite go further and further apart over the course of a longer movement, but only at higher fps.
Why? Well, I´m not certain actually... My first thought was, that the function it goes into should technically run through within a single tick (I think) and a single tick isn´t framerate independent. At 60fps it will take 1/60th of a second to complete, at 240 it will take 1/240th of a second to complete. My idea was to add a "wait" into the function that ensures it will always take, e.g. 0.03 seconds.
Not only did that not work, I also dislike the idea of making my function slower than it needs to be.
My second thought was that the jerkier movement at low fps makes the conditions trigger in a way that ends up giving it a different result. Changing up the conditions (or using no conditions) also doesn´t really work, and replacing the "Set X" with the "Move to" behavior also didn´t work out. (I triggerd the "move to" within the same event where I move the player object in my main project)
I combined everything I tried aswell and still, it doesn´t work. The sprite follows at different speeds regardless. I´m trying it at 50fps, 60fps, 240fps and ~2000fps (unlimited frames mode) and while it works out on one end of the spectrum, on the other the sprite and player object desync.
I did end up doing some absolute code-butchery, where I have the sprite move faster the farther it falls behind and this works out about 90% but it´s not great. What the hell is going on? What am I missing? Obviously my main project is a magnitude more complex (and I don´t wanna post it) so maybe there is something else going on? I don´t think there is but I really don´t know anymore :)
Maybe Ashley has any idea on what´s wrong and what I could do?