Explosion with physics

Get help using Construct 2

Post » 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
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

Post » 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
51
S
10
G
7
Posts: 184
Reputation: 6,825

Post » 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
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Sat Dec 24, 2011 11:58 am

This too is an option but I want to brick fell to the ground
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

Post » 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
ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » 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
93
S
19
G
34
Posts: 1,840
Reputation: 27,963

Post » 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
ImageImage
B
61
S
19
G
6
Posts: 809
Reputation: 9,028

Post » Sat Dec 24, 2011 1:14 pm

any ideas how do it? :)
B
93
S
19
G
34
Posts: 1,840
Reputation: 27,963


Return to How do I....?

Who is online

Users browsing this forum: Magistross, zatyka and 24 guests