iphone - Cocos2d CCSpirte runAction problems -
i using cocos2d , have loop create bunch of sprites, , running action on every sprite in forloop, when run simulator cant see action ..some1 please me
ccaction * action = [ccsequence actions:[ccfadein actionwithduration:2],nil]; for(nsinteger lp = 0;lp<49;lp++) { float sizer = [[numberofelement objectatindex:lp]floatvalue]; ccsprite *_bar = [ccsprite spritewithfile:colorofbar rect: (cgrectmake(10,20,5,sizer*30))]; _bar.position = ccp(5+9.5*lp,((sizer*30)/2)+25); [self addchild:_bar z:1]; [_bar runaction:action]; }
you need create action instance each node.
for(nsinteger lp = 0;lp<49;lp++) { float sizer = [[numberofelement objectatindex:lp]floatvalue]; ccsprite *_bar = [ccsprite spritewithfile:colorofbar rect:(cgrectmake(10,20,5,sizer*30))]; _bar.position = ccp(5+9.5*lp,((sizer*30)/2)+25); [self addchild:_bar z:1]; ccaction * action = [ccsequence actions:[ccfadein actionwithduration:2],nil]; [_bar runaction:action]; }
Comments
Post a Comment