# Physics Explosion

Get help using Construct 2

### » Fri Apr 26, 2013 6:32 pm

I've been over the forums and there seems to be LOTS of ways to do these physics "bomb" explosions.

Most of the solutions on the forums work great with single objects, but when I start stacking objects, it's almost as if the power is diminished.

Is there a single concrete way to make a box explode, in all directions, with equal force? or is it Impulse?

B
12
S
2
Posts: 75
Reputation: 2,126

### » Fri Apr 26, 2013 8:16 pm

are you talking about an explosive box splitting into parts first? or just the objects around it getting pushed away?
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

### » Fri Apr 26, 2013 8:47 pm

Just pushing the other objects out of the way.
B
12
S
2
Posts: 75
Reputation: 2,126

### » Fri Apr 26, 2013 9:29 pm

Impulse at angle.

Angle(bombX,bombY,objectX,objectY)
@bearboxmedia
www.bearboxmedia.com

Nintendo Wii U Developer using Construct 2
B
68
S
8
G
6
Posts: 929
Reputation: 9,356

### » Fri Apr 26, 2013 10:16 pm

preview

There is a second method in this .capx, which applies a force to the 4 corners of the box instead of just the centre.
This is so that even if the explosion centre only has a direct line to one of the corners, it will still push it.
.capx
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

### » Fri Apr 26, 2013 10:20 pm

Awesome guys that's working great. It's just moving everything on the screen. I think I need to add some kind of distance or something, or is it suppose to move everything?

Thanks for the replies you 2!
B
12
S
2
Posts: 75
Reputation: 2,126

### » Fri Apr 26, 2013 11:00 pm

@dooley did you check my cap before posting?
it takes into account distance etc
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

### » Fri Apr 26, 2013 11:11 pm

I could not open it as it uses r126, i'm still using the stable r119. But thanks for posting it. I figured it out, at least for my purposes....

System:(Compare 2 Values)...
distance(Box.X,Box.Y,Item.X,Item.Y)
is "less than or equal to"
(w/e distance in pixels you want.)

Thanks for all the help guys!

p.s. on my last project r126 screwed up the bullet speed of my spawned objects. in r119 I had set a certain speed, with r126 it slowed all my "bullets" down. so I rolled back to r119.dooley2013-04-26 23:14:15
B
12
S
2
Posts: 75
Reputation: 2,126

### » Fri Apr 26, 2013 11:42 pm

you should probably accommodate for any changes an update makes, it can be a little annoying sometimes but it'll be easier in the long run

so it looks something like:

(where radius is the maximum distance)

It means the force will be less the further away the object is.

you know, so it won't be weird when an object is 1px outside of the radius and isnt affected at all, but then may be just touching the radius and suddenly will be blasted away at full force.
B
28
S
8
G
1
Posts: 469
Reputation: 4,683

### » Sat Apr 27, 2013 2:07 am

@dooley There was a bug in r119 where if you had an object with solid behavior in a family with bullet behavior it travelled at double speed. That would explain your slowdown in r126.
B
53
S
28
G
18
Posts: 1,520
Reputation: 24,905

Next