I am working on a game in Game Maker Studio: 2 and am using Delta Time for the time. I understand what it is, how to get it, and how to use it, but I am running into issues when I need to make comparisons that contain values that have been modified by Delta Time.
Example: an item from my game is moving along the x-axis at 2 pixels-per-sec. at 60 frames. The speed the item is moving is then modified by Delta Time, with the x-coord of the item effectively being 'x = 2 * delta'.
Now, I want to check for when the x-coord of the item has reached a certain spot, i.e. 'if(x = "specific spot on axis") {do something}.
The "specific spot on axis" that I am looking for is an integer (no digits after the decimal), but when using delta time, the x-coord is always off by usually miniscule amounts due to adjusting its position relative the speed of change of each frame. Instead of 'x = 12', it is 'x = 12.00387562' or 'x = 11.99943345'.
Right now, I'm thinking that just rounding 'x' at end of each step is all I have to do to fix this, but I also have a nagging feeling that I am possibly missing something right in front of my face. One reason being that, If I round the x-coord at every frame, does that not make a lot of the adjustments made by Delta Time pointless? Is there a (preferably easy and/or concise) way to do comparisons looking for values inside a certain range of digits after the decimal?
All help and insight is appreciated.