[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Smooth animation



update your sprites based on time instead.

You find out where it should be at a certain time,
then move it to that spot.


 --- azazel <azazel_arms@yahoo.it> wrote: > Hi all.
Thinking on the precedent question on
> framerate I've elaborated another
> strange question. If I need to move my sprite
> slowly, for instance, I move it
> 1 pixel every frame update, and when I need to move
> it quickly instead 5 pixels 
> per frame update. The problem is that a sprite which
> "jump" 5 pixels per frame
> don't have a smooth animation, and if I need to move
> it faster, this situation
> became worse. I thought that the solution was trying
> to move it always 1 pixel
> per frame, and setting a different drawing delay for
> every speed. 
> 
> For example, if my game use to run at 60fps and my
> ship have a speed of 5 pixels
> per frame, after 1 second my ship will have run
> throught 300 pixels.
> This means that(using the precedent solution) I
> should update my ship 300 times
> per second, moving it 1 pixel at time. However this
> solution has two big problems:
> - I need to update every sprite in different ways
> - It's virtually impossible to respect those update
> times
> 
> Is there a better way?
> 
> thank you

__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org