Below code is a simplest way to do that.

-(void) explodeBomb
		b2Vec2 force = b2Vec2(0.25,0.70); // give the direction for the force.
		bombBody->ApplyLinearImpulse(force, bombBodyDef.position);
		CCSprite *sp = (CCSprite *) bombBody->GetUserData();
		sp.opacity = 0; // setting the sprite in the body opacity to zero.
		[self schedule:@selector(destroyBomb) interval:2]; //destroying bombBody after 2 sec.
	-(void) destroyBomb
		CCLOG(@"Destroying Bomb");


  1. mr. mac January 31, 2011 at 12:19 pm

    I just got a bunch of errors.
    Do you need to import something?

  2. Mr. Coder February 3, 2011 at 10:26 pm

    what are the errors you got ?
    can you explain.


Leave a Reply

Your email address will not be published. Required fields are marked *




Theme by HermesThemes

Copyright © 2018 CoderzHeaven. All Rights Reserved

Please wait...

Subscribe to our newsletter

Want to be notified when our article is published? Enter your email address and name below to be the first to know.