# Explosion with physics

Get help using Construct 2

### » Sat Dec 24, 2011 11:12 am

I wonder how to make rocket effect after hitting a wall of bricks. After the explosion, every brick flew through the air in a realistic manner.
(if i working on platform game)delgado2011-12-24 11:13:20
B
118
S
32
G
51
Posts: 1,896
Reputation: 38,559

### » Sat Dec 24, 2011 11:37 am

Haven't messed around with the physics in C2 much. But I know in CC,you could check at the point of explosion the distance and angle of each block from it, and then apply force in the opposite direction in comparison to how close the block was and that would get a decent looking result.
B
56
S
12
G
7
Posts: 184
Reputation: 7,150

### » Sat Dec 24, 2011 11:56 am

Well you can also just destroy the brick sprite and spawn some particles. Nobody will check if your "flew through the air" physics is mathematically right (:
B
69
S
22
G
14
Posts: 1,488
Reputation: 16,594

### » Sat Dec 24, 2011 11:58 am

This too is an option but I want to brick fell to the ground
B
118
S
32
G
51
Posts: 1,896
Reputation: 38,559

### » Sat Dec 24, 2011 12:59 pm

just spawn some physics "particles", but you groundobjects wil need to be physic enabled too, or you could just give the particles an impulse when hitting something, so they appear to bounce of floor, wall,

but this effect can be made with normal particles too, with some more work

ow you want the bricks itself fall, then yes, add physics to the bricks and do an impulse on the bricks, vtrix2011-12-24 13:09:49
B
72
S
22
G
7
Posts: 830
Reputation: 10,214

### » Sat Dec 24, 2011 1:09 pm

i try with impulse but particles fly away only with X and Y direction, even if explosion is between two walls, I want to create effect which explosion throw away around bricks naturally
B
118
S
32
G
51
Posts: 1,896
Reputation: 38,559

### » Sat Dec 24, 2011 1:12 pm

hmm yes, you need to calculate the impact/explosion direction relative to the bricks,

lets say you have an explosion sprite, then you would create a angle test on all bricks relative to the explosion sprite

something like this

for each brick
brick.impactangle =
angle(explosion.x,explosion.y,brick.x,brick.y)

impulse at angle = brick.impactangle -180

for strength you can also do a distance check from explosion

vtrix2011-12-24 13:23:33
B
72
S
22
G
7
Posts: 830
Reputation: 10,214

### » Sat Dec 24, 2011 1:14 pm

any ideas how do it? :)
B
118
S
32
G
51
Posts: 1,896
Reputation: 38,559