Destroy one Particle and keep the rest?

Get help using Construct 2

Post » Thu Mar 22, 2012 6:56 am

Hey guys! I'm having some trouble with multiple instances of particles....

I have a Fireball with a Particle trail (smoke).
after 10 "bounces" the fireball is destroyed along with its particle.

BUT....

If there is multiple Fireballs on the screen, there are multiple particles as well. When the first fireball to reach 10 "bounces" is destroyed all the other fireballs loose their smoke trail.

How do I keep the rest of the smoke trails OR do I just allow only one fireball out at a time?

Thanks in advance, you guys are always a huge help.
B
12
S
2
Posts: 75
Reputation: 2,126

Post » Thu Mar 22, 2012 7:40 am

Store the UID of the fireball or of the particle in an instance variable of the fireball/particle and pick it before applying the destroy action.

You can find more about this in the how do I FAQ section "Picking/Selecting instances".
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,999
Reputation: 57,793

Post » Thu Mar 22, 2012 3:00 pm

Thanks for the reply! But....

lol after 2 hours this is what is happening.

    ->Mouse On Left Click > spawn Fireball
                            spawn Smoke
                      set "fbid"(variable inside Fireball) to Smoke.UID                     
After 10 collisions with solid.....
    Fireball "bounces" <= 0
        Smoke Pick instance with UID "Fireball.fbid" > Destroy Fireball
                                                       Destroy Smoke

It works great with 2 Fireballs out. But if I put out 3 or more when the first one gets destroyed, ONE, and only one of the other fireballs looses its smoke, UNTIL another fireball is destroyed.
B
12
S
2
Posts: 75
Reputation: 2,126

Post » Thu Mar 22, 2012 3:15 pm

I'm a total noob so I'm probably completely wrong but couldn't it have something to do with the order in which you destroy the objects? If the smoke uid is stored inside a fireball instance variable, then couldn't it be lost before the smoke gets destroyed?

Again, I know nothing but it might be worth it just to switch the orders there. I dunno if the picked instance is lost if the object that holds its uid is destroyed :/Cliffman2012-03-22 15:16:13
B
6
S
1
G
1
Posts: 15
Reputation: 1,014

Post » Thu Mar 22, 2012 6:02 pm

Rockin' idea Cliffman, Thanks!

But alas, it's still dropping the smoke off ONE fireball for some reason. I'll keep at it though. Thanks again for your reply, it was sound advice.dooley2012-03-22 18:02:48
B
12
S
2
Posts: 75
Reputation: 2,126

Post » Thu Mar 22, 2012 9:10 pm

Can you post simple capx?
B
14
S
5
G
7
Posts: 235
Reputation: 5,175

Post » Fri Mar 23, 2012 3:41 am

http://dl.dropbox.com/u/68726261/Bounce.capx

there is the link, sorry. took me a bit to get the dropbox thing set up and all. Thanks again for the help.
B
12
S
2
Posts: 75
Reputation: 2,126

Post » Fri Mar 23, 2012 3:53 am

u must pick exacly the particle u want to be destroyed.. use the pick function, that might help you ;)
B
30
S
6
G
5
Posts: 433
Reputation: 6,061

Post » Fri Mar 23, 2012 5:25 am

I did use "pick". if you check out the capx just above you. like i said, it works as long as there are not 3+ fireballs on the screen. best i can tell is it is a bug/glitch of some kind. Thanks for the response at any rate..... back to the grind. lol
B
12
S
2
Posts: 75
Reputation: 2,126


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go and 21 guests