android - Cocos2d-x: Create simple progress bar -


i'm newbie in cocos2d-x.

i want create simple progress/update bar game.

when progress bar full, move next level.

how can create bar.

thanks helps.

see - how use progress bar in cocos2d-x , c++

basically, create 2 sprites 1 progress bar's border , 1 loading bar itself.

ccpointer  fuelbarborder;  fuelbarborder =       ccsprite::createwithspriteframename ("bt_progressbarborder.png" ); fuelbarborder->setposition(ccp(100,100)); this->addchild(fuelbarborder,1);     // ccprogresstimer object (smart pointer)  ccpointer  fuelbar;  fuelbar = ccprogresstimer::create(      ccsprite::createwithspriteframename ("bt_progressbar.png" )); 

set loading bar sprite's type ccprogresstimertype.

// set progress bar object kccprogresstimertypebar (%) fuelbar->settype(ccprogresstimertype::kccprogresstimertypebar);  // set anchor point in 0,0 , add child our border sprite fuelbar->setanchorpoint(ccp(0,0));  fuelbar->setbarchangerate(ccp(1,0)); // make width 100% fuelbar->settag(1);                  // tag our object easy access  fuelbarborder->addchild(fuelbar,50); // add inside border sprite 

in update method, change percentage reflect loading percentage.

fuelbar->setpercentage(80); // value between 0-100 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -