Copy of CCSprite?

Hi!
Could you please help: I can’t figure out how can I init one sprite with another. There is no any copy constructors in CCSprite. You see, I have some object like “class Object: public CCSprite {…}”. And I need this object to init with another CCSprite. I can’t simply do: object = CCSpite::create(…);

Thanks in advance.

Overload ‘create’ method and pass CCSprite into it. The method should get texture and other parameters of the input sprite.

dot squid wrote:

Overload ‘create’ method and pass CCSprite into it. The method should get texture and other parameters of the input sprite.

Thank you! But it looks like some kind of hack you know )

Not at all, why? Cocos2dx uses the concept of static ‘create’ methods.

dot squid wrote:

Not at all, why? Cocos2dx uses the concept of static ‘create’ methods.

In my opinion this “concept” is a dirty hack. You see every time I need to do such a thing (explained at the top) I need to make additional mm… body moving… This is not good anyway =)

Yep, I dislike this architectural solution too. But it’s not a hack.
Anyways, I don’t see any other ‘cleaner’ way to copy the CCSprite.

dot squid wrote:

Yep, I dislike this architectural solution too. But it’s not a hack.
Anyways, I don’t see any other ‘cleaner’ way to copy the CCSprite.

Ok, thank you for your answer! )

Try this:
CCSprite* copy = CCSprite::createWithSpriteFrame(sprite->displayFrame());