Problem with Particles

For questions about using Classic.

Post » Mon Jul 19, 2010 7:39 pm

[u:ushvefw1]Hello there, Constructors![/u:ushvefw1] :D

I'm relatively new to construct (been messing around with it for about a month). But recently i've stumbled upon a problem that is just out of my reach of solving. So before i rip my pants in two out of frustration i turn to you in a final attempt of solving the matter.

Well, the problem concerns particles and my inability to specify which one of the instances i wish to destroy during a collision with another object.

This works perfectly well when using 'normal' objects when creating a collision event alone specify that it is the instance colliding that should be destroyed and not the entire object and all of its instances. With particles, though, this doesn't seem to be the case.

Summary: When destroying a particle in a collision event, all instances of the particle is destroyed. I wish to be able to control this, but how?

The .cap is not the project itself (too big and too messy), so I've done a simulation of the problem alone(the same things still occure):

http://www.mediafire.com/?up52o8tglxh2ap2

I would be endlessly thankfull for any help. :D

Thanks!
B
4
G
2
Posts: 8
Reputation: 716

Post » Mon Jul 19, 2010 9:56 pm

[quote="Maisey":1cy3o11y]Summary: When destroying a particle in a collision event, all instances of the particle is destroyed. I wish to be able to control this, but how?[/quote:1cy3o11y]

that should be simple... you can't. you must make your own particle simulation. you can create a sprite, give it a ball movement behavior, uncheck the "rotate object" (something strange happens if you don't, actually) and when you want it to go boom, you must:

on somethingsomething:
repeat (100)
-> create sprite somewhere
-> set ball angle of motion to random(359)
-> set ball movement speed 50+random(50).
-> set ball movement acceleration to -50

on sprite collision with somethingsomething:
-> sprite: destroy

above is just an example, but try it, you should be fine
B
81
S
50
G
10
Posts: 555
Reputation: 13,009

Post » Mon Jul 19, 2010 10:17 pm

Ok, if you are trying to destroy the particle effect and the sprite at the same time, then this is easy.

Join the ball and the particle effect with a container, which is in the properites of each object. It is just a link so it doesn't matter which object you do it to, it will affect both.

Now they will create and destroy together, you only need to handle the positioning yourself. So in your events you need to delete the creation of the particles, and delete the destroy events for the particles as well.

Hope that is what you were after.


Here is the edited cap by the by.
http://dl.dropbox.com/u/1487524/Scirra/ ... xample.cap
B
9
S
2
G
4
Posts: 346
Reputation: 2,726

Post » Tue Jul 20, 2010 1:28 am

Thanks for the quick responses guys!

Really helpfull! Problem solved. :D

And Steven, your example worked exactly the way I intended it to. Thanks a bunch!!

xD
B
4
G
2
Posts: 8
Reputation: 716


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests