Hello to all, sorry for my poor english. Fabrice, 40 years old, electronic engineer (RTOS), started with C64, ddraw, dx, etc…
First at all I want to congratulate all the people who are working for free here. This product is amazing.
So I’m a new user of coco2d V3 (1 month), I’m learning and all is running very well but I would like to understand what I’m doing, ok it works but I want to be sure to understand because I started a very big project and I do not want memory leak at the end.
It will be very helpful if some one can explain why I have to do some action.
mNode = node; // node is the layer I want to attach the atlas (a tilled map of a city like the sims)
cocos2d::SpriteBatchNode* atlasNode = cocos2d::SpriteBatchNode::create(“worker.png”);
sprintf(spriteName, “worker%.3d.png”, k+1);
// QUESTION: since sprite from mWorker is coming from atlasNode why do I need to add again to altas?
mNode->addChild(atlasNode, 999); // ok???
// in my atlas I have toons of sprite from different worker that will be probably never used by the user at the start of the game
// is it a problem?
//some where in the update I change the sprite to play an animation (I do not want use animation class)
// for example for a worker who is walking in the street I use different sprite and I change like that
// QUESTION Do I need to release the previous sprite in mworker and do I need to again do “atlasNode->addChild(mWorker[mWorkerId]);” since mWoker is a new sprite.
// when I switch a city how do I attach the atlas to the new city Node and how do I release the atlas AND all the sprite I used in the previous node?
// Do I need to do that?
// last question my Atlas is 120 Mb byte is it a problem??? Or do I need to change strategy
Thanks for all