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

Re: [pygame] keep a key pressed and then move a sprite



On 2010.11.24 1:53 PM, Nathan BIAGINI wrote:
Ok thanks to reply so fast :) yeah of course, it seems obvious now but i
didn't know there is a way to manage keyboard state without the common
event loop.
I ll use this created topic to ask something else about the optimization
of a game written with pygame. Restrict frames per second with
clock.tick(xx) and only update dirty rects (in case of static
background) is enough for a quite "simple" 2D game? Or there re more
optimizations to do? I don't try to reach perfect performance, only want
to make my faster as possible and less CPU consuming.

One other thing to try is an acceleration system.
"Psyco" uses a compiler to speed up a Python program very easily. See http://psyco.sourceforge.net/ . All you need to do after installing it is add the code "import psyco ; psyco.full()".

"Boost" ( http://beta.boost.org/doc/libs/1_45_0/libs/python/doc/index.html ) lets you write code in the C language and access that from Python. I've not tried that.