J
JohnG
Guest
I don't think I'm understanding the relationship between the speed variable and step instance and how I use these to calculate how many steps an object will take in order to cover a known distance. Here's an example of something I've been tinkering with.
speed = 3
distance = 24 (pixels)
# of steps = distance / speed
My assumption is that the number of steps the object will take equals the distance divided by speed. Given the data above an object will take 8 steps to cover a distance of 24. But I don't think that's correct.
For more context, I have a counter that decreases while an object covers a specific distance. I want that counter to reach zero once the entire object has completed the distance, but the math isn't coming out to zero. I also suspect I'm not accounting for the the width of the object and I should be.
Any ideas?
speed = 3
distance = 24 (pixels)
# of steps = distance / speed
My assumption is that the number of steps the object will take equals the distance divided by speed. Given the data above an object will take 8 steps to cover a distance of 24. But I don't think that's correct.
For more context, I have a counter that decreases while an object covers a specific distance. I want that counter to reach zero once the entire object has completed the distance, but the math isn't coming out to zero. I also suspect I'm not accounting for the the width of the object and I should be.
Any ideas?