On Sunday 10 February 2008 00:12, Ian Mallett wrote: > On Feb 9, 2008 4:08 PM, Mikhail Ramendik <[EMAIL PROTECTED]> wrote: > > Thanks, but as I understand this will lock the code until a key is > > pressed? > > No... > You'll get input each frame which this function.
So I should just call it each time from the main loop? > I'm not sure what you > mean by "lock the code". I thought it was waiting for a keypress - was wrong. > > I am planing to have other sprites "floating", so will need to update > > them periodically as well. I don't want to use threads - the task is way > > too simple for the hassle. > > You are right. > What you should do is have each sprite have a coordinate and an x and y > speed in a list. > If you want them to have rotations or have different aspects (like color, > picture, size, etc.) a class might be better. > Then, you just move each sprite's position by its speed. Actually I do plan to have a different picture for each sprite. So I was planning to use the Sprite class to store the pictures and coordinates, and only do the blit in the main loop. As for moving position by speed - I would somehow need to coordinate it with real time as "speed per loop" seems somewhat meaningless. I am a total beginner in pygame and that's why I hoped to see an example. Right now I am not even sure how the main loop should be constructed. (I really am only doing it because I have a kid unedr 3 yo, and all the Linux "games for small children" rely on the mouse - which my kid does not grok, and I see his point, the mouse thing is really way less "natural" than keys. My aim is to do enough for my son's fun - then I'll just release the code, perhaps someone else will want it). -- Yours, Mikhail Ramendik
