[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



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
> ...

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?

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