How do I make particles retain properties for each instance.

Get help using Construct 2

Post » Tue Sep 13, 2016 10:14 pm

Ok, I apologize if this is oddly worded, but bear with me here.

So I'm trying to use a particle effect to create a small dust cloud every time my player lands.
I created the object, and configured the particle to have the properties that I want, and placed it in the layer out of view (since I can't call it without it already existing within the project).
I setup my character object to create the particle object on landing; simple.
When running a preview, my character lands on the ground, and the particles appear, but they are set to the default settings (as in the settings before I modified them) for the particles.

I made sure that when I changed the properties of the object/particles that I didn't just have a single instance of it selected, rather I clicked on the it via the projects tab, and changed the properties before every dragging the first instance of it into the layout. To make sure I configured it right, I took the particle object that I already had in the layer and put it in a place where I could see it upon starting up the project, and it works fine.

How do I set it up so that every time my player object lands the particles retain the custom settings?
B
17
S
2
Posts: 37
Reputation: 906

Post » Wed Sep 14, 2016 12:39 am

You have to have an initial instance in the layout because this is where it takes the properties from. IID identifies the object instance, and the version of the Particle object with the lowest IID will be the one where the settings are taken from. It is possible that you have edited an instance of the Particle object that is not the first object of its type, it is taking the default settings from the first Particle you placed. You could create 100 Particle objects with different properties and on Create Particle object it would still use the settings of the first instance you added to the layout. Select the Particle objects in debug preview and look at the IID in the object properties, you will be looking on the left for Particles #0. The instance with the lowest IID will have the same properties as the one 'created'.

Any of the Particle objects you place in view initially will always look correct as they can have separate settings, it is only when you use the Create Object action that it picks the settings from the lowest instance (unless you specify with conditions in the event sheet).
B
47
S
17
G
81
Posts: 2,223
Reputation: 48,093

Post » Wed Sep 14, 2016 2:45 am

I tried it and it seems to be ok. :? (Press 'Space' to generate a new instance of an object that shares the same particle setting as the Player.)

https://www.dropbox.com/s/x72da9qdngtn0 ... .capx?dl=0
B
11
S
6
G
15
Posts: 256
Reputation: 9,207

Post » Wed Sep 14, 2016 6:40 pm

I didn't notice (or forgot to mention) that all properties except for the angle were carrying over.

Thanks Gmoney, looking at your capx I was able to figure out how to get it working. All I had to do was define the angle of the particles when they spawn, rather than relying on the properties of the particle object that I had in the layout.

To summarize:

1.) I made a particle object, defined its properties, and put one instance of it in the layout outside of view.
2.) After making the player object spawn the particles on landing, all custom properties from the particle object were showing up, except for the angle.
3.) In the event sheet, I defined the angle of the particles on their creation by the player object, now it works great.

Thanks for the help!
B
17
S
2
Posts: 37
Reputation: 906


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 8 guests