Hi, I’m working on a character with sprite and animations.
unique_ptr<Sprite> sprite; map<string, unique_ptr<Animate>> animations; ... animations["Idle"]->initWithAnimation(Animation::createWithSpriteFrames(frames, 1.0 / numImgs)); sprite->initWithSpriteFrame(frames.front());
What I did before was to create one Sprite per one Animation.
But I don’t want to create by Sprite::createWithSpriteFrame() cause of allocating Sprite per Animation(I thought it need more memory).
Is that code right way to re-use one allocated Sprite object? or use setSpriteFrame() ?