Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6239601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T11:25:11+00:00 2026-05-24T11:25:11+00:00

I am trying to put a bomb in some place and when it explodes

  • 0

I am trying to put a bomb in some place and when it explodes every thing around it will fly away and the speed depends on how close the object to the bomb.
something like when the black bird explodes in angry birds.

can any one give me a sample code or a way to do that (I am using andengine with box2d)

thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T11:25:11+00:00Added an answer on May 24, 2026 at 11:25 am

    If it is going to be realistic(ish), like Angry Birds, then for each object that is blown apart by the bomb, it will follow a quadratic path.

    I dont know andengine or box2d. But I have done simple 2d explosion and projectile modelling in a game.
    I hope you can take something from the following:

    You would want to find out the (x,y) coord distance of the object from the bomb. From this calculate the angle. (for example an object above the bomb as it explodes will have angle 90 or pi/2.

    From this work out the sin and cos of the angle. Multiply it by some force factor F. (depend son the strength of the bomb and distance of object from bomb.) From this you have your initial vector of movement {F*Math.cos(angle),F*Math.sin(angle)};

    From here out it is just plane kinematics. The object should follow a quadratic path through the air. The equations may look something like:

    object.setXCoord(object.getXCoord()+time_constant); //after initial explosion, no force is      
                                 //acting horizontally on object.
    
    
    object.setYCoord(object.getYCoord()-some_constant*time_constant+another_constant*time_constant*time_constant);// note Y's path 
                                                      //relative to time is quardatic.
    

    You will probably need to add some casts in there depending on what types you will use. All the constants depend on your game. time_constant may well be 1, but I found doing a multiple of 1 made the explosion more visually appealing. i.e. as your time counter t increments, the movement of the object may use time_constant 0.5. I used a lot of trial and error to see what constant values worked best.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I trying to put together an Android app that will take a picture and
I am trying to put some distributed caching into play, I'm using this indeXus.Net
I trying to put some images into the hub tile as the window phone
I'm trying to put into XML-file some data. Here is the code: @Test public
I am trying to put bar to close to black footer its working in
I am trying to put some JSON formatted data via Ajax with jQuery to
I'm trying to put some (vertically-stacked) display:block elements within a display:inline-block element. According to
i am trying to put some word in tempfile via commandline temp file creat
So I am trying to put together a small lightweight framework for some basic
I'm trying to put a button at the bottom of a webview. For some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.