I've been working on a game for a while, and I'm starting to run into issues with slower performance machines.
I've been trying to use DT everywhere I could, but I believe I may have been programming incorrectly, and I wanted to see what the best approach would be.
Normally what I would do is set an instance variable (#) on an object. I would then set "if instance variable > 0, every 0.1 second, subtract 1 from instance variable". Then, whatever I wanted the sprite to do; attack, jump, etc. I would go "if instance variable = 0", do this and set instance variable to 10.
Now, of course this works on probably all machines. But I'm using this for everything, and I'm afraid it's not a good way to do it. For instance, I have an air dash in my game that sets an instance variable to 4, and subtracts every 0.1 seconds moving 1500*dt pixels every tick. However, the end location doesn't match up when the fps is low (<25), and I can sometimes dash through walls, which is unintended.
I've tried adding dt to the variable and setting when the variable > or equal to X (usually the number of seconds I want it to last), set back to 0, but it still doesn't have the same result everytime.
I'm using this to change enemy attacks, as timers for reloading, damage timers, etc.
So my questions is this: What am I doing wrong, and what should I be doing instead?