thank you!

On Mar 14, 6:39 pm, claudio canepa <[email protected]> wrote:
> On Wed, Mar 14, 2012 at 2:09 PM, Philippe <[email protected]> wrote:
> > Hello,
>
> > In one layer, I have a sprite: self.spt = Sprite('im1.png')
> > then I self.add(self.spt)
>
> > I did not find a way to change the png in that Sprite.
> > Then, I try to swap it.
>
> > is this the best way to do it ?
>
> > self.remove(self.spt)
> > self.spt = Sprite('im2.png')
> > self.add(self.spt)
>
> > I have to do it often. Like once every 2s, during 4 hours.
> > I do not need to rember or re-use older sprites.
>
> > thanks
>
> I would go with something as
>
> def change_image(self, image_name):
>     img = pyglet.image.load(image_name)
>     self.image = img
>     self.image_anchor = ...
>
> --
> claudio

-- 
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/cocos-discuss?hl=en.

Reply via email to