-
Chain explosion
Hello everyone,
I'm new here, can someone please tell me how to get all connected objects to change animation while leaving the unconnected ones alone.
Example
I have multiple boxes and would like all connected ones to be destroyed when a bullet hits them. Kind of like a chain explosion.
Thanks.
-
Re: Chain explosion
are you talking connected like in a straight line? or connected going all kinds of directions?
-
Re: Chain explosion
If you have an explosion animation, create that animation at the center of the box when the bullet collides with the box. (Make sure the explosion animation is bigger than the box so it collides with the other boxes) Then make an event:
If Box_Explosion collides with Box
>Destroy Box
So you have two separate objects. A static box, and an explosion. Here's a good example: the box object is 16 pixels by 16 pixels and the explosion object is 32 pixels by 32 pixels. This will make the explosion cover all the boxes surrounding the box the object was created at. (Check the hotspots and action points of the box objects and explosion object)
In the end you should have three events for this.
If Bullet collides with Box
>Create Box_Explosion at position 0,0 relative to Box
>Destroy Bullet
If Box_Explosion collides with Box
>Destroy Box
If Box_Explosion animation has finished
>Destroy Box_Explosion
-
Re: Chain explosion
-
Re: Chain explosion
Thank you for the reply Jeod and xXjbroXx
But there's a problem, it destroys the boxes which are unconnected too.
For example I have 2 sets of boxes, 3 on the left which are connected and 5 on the right which are connected. When the bullet hits the boxes on the left, the ones on the right are also destroyed, how can I make each set independent.
-
Re: Chain explosion
If you duplicated the boxes that shouldn't happen. Try grouping the boxes with a qualifier.
-
Re: Chain explosion
yes you could use "good" for connected boxes and "bad" for unconnected ones.
-
Re: Chain explosion
erm... no. That wouldn't work. You can't set individual instances to a qualifier.
-
Re: Chain explosion
You could just make an invisible mask to check for connected boxes.
-
Re: Chain explosion
Better still you could just set a variable to a number when you create the boxes. Set box type a to 1, box type b to 2, etc. Then just check which Id the box has when you do your overlap check.
-
Re: Chain explosion
Thanks for the feedback everyone.
Mobichan, that method does not work as I have an attack that creates the boxes (so all boxes in this case would have the same ID). The boxes are not pre-placed. UrbanMonk, I don't understand what you mean, I thought I was already doing that when Jeod suggested that I have an explosion bigger than the boxes?
-
Re: Chain explosion
I have a few different examples of chain explosions that I was going to submit to nirvams site later this week. When I get home I could post them if you like?
Ok here is a quick example I made (not the ones for nivrams site)
Does this help at all? http://www.box.net/shared/2og7sga5rt
-
Re: Chain explosion
Many thanks Gerald999, that is really helpful, your solution of using the animation of frames getting bigger to solve the problem is a really nifty trick. I think I can apply it to other things as well with a bit of alteration.
-
Re: Chain explosion
I am glad it help :grin:
There are many ways to achieve that effect, that was just one way