You can not run any action or animation on a box2D object directly. You have to access the box2D objects userdata (i e CCSprite). Then run the action or animation code on this sprite. This is the code to access the box2D objects sprite-
Here _world = Your Box2d World
aNumber = The tag you must set to identify the box2d object when you create them
for(b2Body *b = _world->GetBodyList(); b; b=b->GetNext()) {
if (b->GetUserData() != NULL) {
CCSprite *sprite = (CCSprite *)b->GetUserData();
if(sprite.tag==aNumber)
{
//Do the action or animation code
}
}
}
Here _world = Your Box2d World
aNumber = The tag you must set to identify the box2d object when you create them
Thank you for the info. It sounds pretty user friendly. I guess I’ll pick one up for fun. thank u
ReplyDelete------------------------------------------------------------------------------------
iPhone Application Development