Hi all
I think there are different ways to solve the problem, depending on
your project. The most proper way is to have more animation movements
to make it looking slower (probably easier when using opengl than
pure 2D).
If anything starts lagging when moving around you have to optimize
it. Some ideas:
- Aplhablitting takes longer than w/o
- Do you really need a framerate of 30? Many games works also great
with a lower framerate
- Some precalculated shapes (f.e. rotation) will be blitted faster
than bring it to the right size/rotation, etc. Sure, the memory
consumation is going up on precalculated and in memory stored images
- if you move sprites/images around the screen, then make sure to
reblit the background only where its needed
- Is there a lot of Python code between two blit steps? Can that one
be optimized?
- Many people calls the pygame functions (and also other included
packages) by its packagename.function_name. If such a routine is
called often (thousands of times and more) that way (like a lot of
blitting) it can be optimized: In your variable declaration area
write: paint = pygame.blit
Late on in the code use "paint (image...)" instead of "pygame.blit
(image...)". This helps Python not to check all the time if the
module/function is present and valid.
There are many many more optimation possibilities but they are
heavily project related.
Keep in mind that Python is still a scripting language, tough the
makers of Pygame made a great job with it!
Just my 2 cents.
Gruss Farai
Am 14.10.2006 um 00:37 schrieb Kai Kuehne:
Hi Luke,
On 10/14/06, Luke Paireepinart <[EMAIL PROTECTED]> wrote:
[Documentation]
HTH,
-Luke
Not really. Ok, maybe I'm a bit tired but I try to explain the real
problem I'm currently have (primarily in thinking, well could be also
time-related ;).
My real problem is how to move something slow and another thing
really fast if I set - let's say - the frame rate to 30. For the
slow-thing
I could move it 1 pixel per frame. Ok, works great. And the fast-
thing could
be moved 3 pixels per frame but than it looks not very cool. It's
lagging
and you see the movement-steps. And what if the slow-thing is too
fast, though?
I cannot set the speed to 0.5 because pygame.Rect uses integers for
the
position things.
Probably (well, surely probably) this is a noob question. But atm,
I'm not getting to it...
Thanks
Kai