I've recently recreated a version of Lunar Lander (you know, the old retro game) in Python 3 and Pygame: my lander moves (???rect.move
) each frame along the y axis because of gravity.
Problem:
Until I hit 1 m/s, the y value added to rect.move is a float under 1: I must use int()
to round it up, as pygame doesn't like floats.
In a previous version with Tkinter, the y coord of the lander was like this:
0.01
0.02
...
0.765
1.03
1.45
...
In pygame it's
0
0
0
...
1
1
1
2
2
...
This is really annoying, as the movement isn't fluid.
Does someone know how to solve this? Like, input a float to rect.move
?
Thanks in advance!
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…