On 16.10.2013 22:43, Eamonn Rea wrote:
Well now I have a problem! I have both my images (one sheet for the player moving left and one for right (I'd like to have it this way)), but both of them draw... and only draw. The animation doesn't play. Is there a way I can make it so an image wont draw in Cocos unless I set it to, and also to stop/start an animation when I want too? If you want *all* my code:

Your animation does not play because it's only 1 image.

Take a look at this:
self.playerLeftGrid = pyglet.image.ImageGrid(self.playerSheetLeft, 1, 1, item_width=32, item_height=32) self.playerRightGrid = pyglet.image.ImageGrid(self.playerSheetRight, 1, 1, item_width=32, item_height=32)


The 3 first arguments of ImageGrid are "image", "rows" and "columns". You have passed 1, 1 for rows and columns, meaning that the grid only contains one region, instead of a series of regions.

When you create the animations:
self.playerLeftAnim = pyglet.image.Animation.from_image_sequence(self.playerLeftTexture, .32, loop=True) self.playerRightAnim = pyglet.image.Animation.from_image_sequence(self.playerRightTexture, .32, loop=True)

self.playerRightTexture is just a single image, the animation appears to not be playing because it has no other frames to iterate over.

--
You received this message because you are subscribed to the Google Groups "cocos2d 
discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cocos-discuss.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to