Help making a entity explode when shot

I am making an Fps game and want some cool BOOM BOOM POW barrels that explode. In my shoot script, I have made it that if the Barrel is shot result Boom in the explode script. I don’t know what to do from that to make it so that it blast the player and enemies away in the explode script. Plz help

Hi @Connor_Briggs,

For the explosion effect there is a nice example here:

To make the explosion affect entities nearby, pushing them away, what I’d do is:

  • Find those entities, the easiest (though not most performant) way is to loop through your dynamic bodies and check their distance from the explosion.
  • For the bodies that are close to the explosion I’d calculate a force for each one, pointing from the explosion point towards the position of the body. And I will scale it down in relation to the distance from the body. The further away, the smaller the force.
1 Like

okie I’ll try that thax