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

Re: [pygame] Animating sprites



Chris Smith wrote:

It is highly likely that this animation will have to happen during
some number-crunching C code called from python. I can't really afford
the overhead to check back with python to see if the sprites need
updatiing.

What I need is either a regular timed interrupt, or a way for pygame
to do it for me.


I'm no expert on threads, but if you have a c-function which does longer-lasting number crunching in one go, threads may be the way to go...

maybe just start one thread for the number crunching and in the meantime, pygame.time.wait(12) or whatever and check if the sprite(s) (and maybe other fx in the future of your game) needs updating. doesn't sound too complicated for me.

Sorry, no regular interrupt as far as i know. It would need threading too to execute some other code at the same time as your code, i guess.

Yours,

   Daniel