andylatham82:
deltaTime goes down to 2 milliseconds, which is just 10 in binary, and this gives 0 when shifting right by 3 places. What do I do in this case?
One way to deal with that is to increase all the values by a factor of maybe 210 so that the values remaining after a shift are meaningful. Then, if necessary you can decrease the final value back to its real-world equivalent.
Be aware if you do this that you may need to use larger variable types - an int instead of a byte or a long instead of an int. It may also be wise to have all of the values of the same type even if the size of the number does not warrant it to prevent strange arithmetic errors if the compiler chooses the wrong type. Of course using larger variables uses more memory and I don't know if that might cause you a problem.
...R