Reputation: 81
So I've noticed that character only moves when my velocity is greater than 1 and is an integer but the question is why I can't use move_ip() function to have my character move slower than 1 velocity and in between 1 and 0?.
Here is the code that I use:
def Physics():
for k, v in enumerate(ENTITIES):
vel = ENTITIES[k].GetVelocity()
pos = ENTITIES[k].GetPos()
vel[1] = vel[1] + 0.1
ENTITIES[k].Entity.move_ip(vel)
Upvotes: 1
Views: 333
Reputation: 101052
The Rect
class is typically used to describe an area of the screen, and pixels are integer values, and thus the properties of the Rect
class are integers also (you can't draw something at position (1.3, 5.7)
, since that position does not exit on the screen).
If you want to keep track of a sub-pixel position, such as 4.5
or 1.2
, you have to store it in another variable/field of your class.
Upvotes: 1