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

Re: [pygame] Help : speed



First, to answer your question:

> --------------------------------------------------
> def move(self):
> 
>       global counter
> 
>       self.sp = counter*self.speed
> 
>       if self.sp == int(self.sp) :

either counter is an int, and self.sp is ALWAYS equal to int(self.sp) or
counter is a float based on some timer, in which case self.sp is
ALMOST NEVER equal to int(self.sp)

Second, some advice.

Your intent to move sprites at most one pixel every update() for the
sake of "smoothness" sounds quite a bit like "Optimizing Early". 
Optimizing early is a bad thing, and you will probably be better served
by not worrying about such things.

Your sprites will probably move very smoothly on their own.

-sjbrown