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

Re: [pygame] I can't seem to find any simple sprite animation game examples on the pygame.org site



On 9/13/07, Greg Ewing <greg.ewing@xxxxxxxxxxxxxxxx> wrote:
Ian Mallett wrote:
> if frame_number%10 == 0: #frame_number is a multiple of ten
>   #draw frame 1
> elif frame_number%9 == 0: #frame_number ends in 9
>   #draw frame 2
> elif frame_number%9 == 0: #frame_number ends in 8
>   #draw frame 3
> ...

I think I issued a correction with the different numbers earlier.

Were there supposed to be different numbers in that? :-)

Also, wouldn't it be easier to use the frame number
as an index into a list of images?

Yes.

If your frames are all together in one image, you can
use the subsurface() method to chop them out and store
references to them in a list.

--
Greg

Ian