selecting instances of one object

New releases and general discussions.

Post » Thu Jan 08, 2009 4:19 pm

there should be a way to select a certain instance of an object (if used many times) in the event editor and perform an action on it.
B
2
G
4
Posts: 43
Reputation: 1,136

Post » Thu Jan 08, 2009 4:22 pm

How do you mean? Isn't that what conditions do anyway? In what situation would it be useful?
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Thu Jan 08, 2009 6:29 pm

[quote="Ashley":36767xlg]How do you mean? Isn't that what conditions do anyway? In what situation would it be useful?[/quote:36767xlg]
i have several objects that glow, and if i want to destroy only one of them when you walk over it, what would i do?
B
2
G
4
Posts: 43
Reputation: 1,136

Post » Thu Jan 08, 2009 6:34 pm

Have a condition which tests for the collision then a destroy action.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Thu Jan 08, 2009 6:47 pm

[quote="Rich":godhh9qg]Have a condition which tests for the collision then a destroy action.[/quote:godhh9qg]
that doesn't destroy all of them?

EDIT: it destroyed all the glows in the layout.
B
2
G
4
Posts: 43
Reputation: 1,136

Post » Thu Jan 08, 2009 6:50 pm

No, only ones involved in the collision.
B
3
S
2
G
5
Posts: 1,777
Reputation: 5,529

Post » Thu Jan 08, 2009 6:59 pm

[quote="Rich":3szvio10]No, only ones involved in the collision.[/quote:3szvio10]


"On collision between player and blueplant ---> blueglow: Destroy."

there are multiple "blueglow" on every plant in my layout, and it destroys all of them on collision with any blueplant.
B
2
G
4
Posts: 43
Reputation: 1,136

Post » Thu Jan 08, 2009 7:02 pm

[quote="zephyrus":2oohy9eg][quote="Rich":2oohy9eg]No, only ones involved in the collision.[/quote:2oohy9eg]


"On collision between player and blueplant ---> blueglow: Destroy."

there are multiple "blueglow" on every plant in my layout, and it destroys all of them on collision with any blueplant.[/quote:2oohy9eg]

Put the blueglow objects in a container with the blueplant objects. That way when you collide with the blueplant object, it will automatically pick the glow object associated with the plant. Containers wiki page. Hope that helps. :)
Moderator
B
98
S
37
G
19
Posts: 1,584
Reputation: 17,817

Post » Thu Jan 08, 2009 7:06 pm

[quote="linkman2004":3e4lnomn][quote="zephyrus":3e4lnomn][quote="Rich":3e4lnomn]No, only ones involved in the collision.[/quote:3e4lnomn]


"On collision between player and blueplant ---> blueglow: Destroy."

there are multiple "blueglow" on every plant in my layout, and it destroys all of them on collision with any blueplant.[/quote:3e4lnomn]

Put the blueglow objects in a container with the blueplant objects. That way when you collide with the blueplant object, it will automatically pick the glow object associated with the plant. Containers wiki page. Hope that helps. :)[/quote:3e4lnomn]
awesome. thanks!
B
2
G
4
Posts: 43
Reputation: 1,136

Post » Thu Jan 08, 2009 7:30 pm

In this case though you can't use containers to destroy the glow. If you destroy one object in a container, it destroys all the objects in the container. Since you want the plant itself to stay, you'll have to find another way.

If you're going with containers, you could make the blueglow invisible when you touch a plant, instead of destroying it.

If you're not going with containers, then you'll have to define which blueglow you mean in your conditions. Construct can only pick the proper instances if you tell it which ones to pick in your conditions.

This:
"On collision between player and blueplant ---> blueglow: Destroy."

Is incorrect. You haven't defined which blueglow you want in the condition, so they all disappear. Try this:

[code:1pyvw0wt]
+On collision between player and blueglow
->blueglow: Destroy
[/code:1pyvw0wt]

Since the blueglow has been defined in the condition, that's the only blueglow picked for destruction.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Next

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 7 guests