[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] How to make a (fast) smooth movement on 30 frames



Kai Kuehne schrieb:
Hi!
Im currently creating my first game. A simple space shooter.
I have set the frame rate to to 60 with pygame.clock.tick(), but
the game uses more than 90% of my CPU time. That's a problem,
because there is almost nothing on the screen yet (just three ships...).
When I set the framerate to 30, the CPU uses ~30%. I would say,
that's besser. =) But the ships are flying too slow now...

Ok, no problem.. just set the speed to, say, 5 pixels per frame.
Now there as fast as with 60 frames, but there lacking.

How can I use (say) 30 frames and make a smooth movement for
the objects that are on the screen?

If you need code snipplets, I post them later on that day.

Thanks in advance!
Kai

Hi

was it the pygame.clock.tick() the method that used a busy loop to get the right timing? The online documentation seems to have changed and says not so. If the tick() method uses a busy loop then your nearly 100% cpu usage would be esxplained...

For the movement I would recomend time based movement because then they move on every machine at same speed :-).
For a really smooth movement I think you would have to use motion blur, but I do not know how to do that.


~DR0ID