Physics Explosion

Get help using Construct 2

Post » 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?

Thanks in advance
B
12
S
2
Posts: 75
Reputation: 2,126

Post » 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

Post » 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

Post » 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: 931
Reputation: 9,360

Post » 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

Post » 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

Post » 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

Post » 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

Post » 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

but anyway, if you multiply your force by 1-(distance/radius)

so it looks something like:
Force*(1-(distance/radius))

(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

Post » 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
54
S
28
G
18
Posts: 1,520
Reputation: 25,020

Next

Return to How do I....?

Who is online

Users browsing this forum: BACLog, Google [Bot], Kagubro and 17 guests