thegooglecodearchive / los-cocos

Automatically exported from code.google.com/p/los-cocos
0 stars 0 forks source link

problem with animation in ActionSprite #57

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
new API for ActionSprite breaks when instead of a static image, it is
passed an animation. pyglet sprites will accept animation, and the previous
API for Cocos 2.0 also did. By animation I mean something like:
pyglet.image.Animation.from_image_sequence(sequence=[resource.image('%s%02d.png'
%(anim_name,x))
for x in anim_range],period=anim_period,loop=True))

What version of the product are you using? On what operating system?
Cocos 0.3 rev 524, pyglet 1.1 beta 1, linux (Kubuntu Feisty)

Please provide any additional information below.
The error message I get:

(...snipped stuff...)
[err]   File "/home/thomas/python/my/meta2-repo/trunk/res/widgetlayer.py",
line 509, in get_sprite
[err]     return
ActionSprite(pyglet.image.Animation.from_image_sequence(sequence=[resource.image
('%s
%02d.png'%(self.name,x)) for x in self.anim_range],period=self.secs,loop=True))
[err]   File "/home/thomas/python/my/meta2-repo/trunk/res/cocos/sprite.py",
line 72, in __init__
[err]     image.anchor_x = image.width / 2
[err] AttributeError: 'Animation' object has no attribute 'width' 

seems to be that the problem is that the new api expects an image with a
width attribute, but animations do not have it.

let me know if you want some example code, mine is kinda messy to send, but
I could make a small version to show the bug.

Original issue reported on code.google.com by twoelz on 1 May 2008 at 9:51

GoogleCodeExporter commented 9 years ago

Original comment by ricardoq...@gmail.com on 1 May 2008 at 1:21

GoogleCodeExporter commented 9 years ago
fixed. when creating a sprite with an animation, all frames get as anchor 
x/2,y/2,
with x,y being the size of the first frame.
added test_animation.py and gif animation.

Original comment by lucio.to...@gmail.com on 1 May 2008 at 9:40

GoogleCodeExporter commented 9 years ago

Original comment by lucio.to...@gmail.com on 1 May 2008 at 9:41

GoogleCodeExporter commented 9 years ago
great! thanks!

Original comment by twoelz on 1 May 2008 at 11:27