How do I Make object with same variable Visible {solved}

Get help using Construct 2

Post » Tue Oct 03, 2017 1:38 am

The issue was having a test particle system around at start of scene and not deleting it before I instantiated new ones for each laser pod.

Hello Constructors.

I am having trouble making an object with the same variable visible on toggle. I make a variable on a particle system the same as the creating objects UID so that they are tied together with this number. It looks right to me but is clearly not. Could I get a hand with this?

Here is an image of the issue:
Imagetoggle_particle_effect by kessler_3, on Flickr
Last edited by KSLR on Tue Oct 03, 2017 4:57 am, edited 1 time in total.
B
54
S
17
G
6
Posts: 307
Reputation: 10,979

Post » Tue Oct 03, 2017 4:37 am

Could you share the screenshot of the code where you assign this var_UID to both objects?

Actually, the name "var_UID" is quite confusing, which object's UID it is supposed to be?
If you want to tie prt_laser to obj_laser, you only need to create this instance variable on one of the objects (prt_laser), not both.
Rename prt_laser.var_UID to prt_laser.obj_laser_UID
Remove obj_laser.var_UID

When you create your particles, do this:
prt_laser.obj_laser_UID = obj_laser.UID

When you want to pick particles tied to your laser, do this:
prt_laser -> Compare instance variable -> obj_laser_UID = obj_laser.UID


Or you can simply add both objects to the same container. They will be spawned together, destroyed together and when you pick laser instance in your events, its corresponding particles instance will be picked automatically.
Image

Did I help to fix a problem in your game? You can buy me a cup of coffee :) If you'd like to hire me, please see this post
B
19
S
9
G
158
Posts: 2,401
Reputation: 84,429

Post » Tue Oct 03, 2017 4:48 am

Thanks for the response Dop2000. I think i have found a bug. my code works perfectly with a regular sprite but not with a particle system for some reason. I will do some more testing.
B
54
S
17
G
6
Posts: 307
Reputation: 10,979


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 4 guests