How do I access the object type inside a Family event?

Get help using Construct 2

Post » Thu May 22, 2014 7:57 pm

I have a family of objects. I have an event that says "when a member of the family is clicked, do something". Is there a way to differenciate the specific object type that was clicked?

Here's a basic example of what I mean:

Family "Pokemons" contains the following objects: "Bulbasaur", "Charmander" and "Squirtle".

On Mouse click on "Pokemon", do something. If the Pokemon is a charmander, do another thing. If it's a bulbasaur, do something else. And so on.

(The text with emphasis is the part that I'm wondering how to do)

So, again, my question is, in an event that was triggered by a family, how can I figure out which family member (which object type) is actually involved?
B
20
S
5
Posts: 80
Reputation: 1,408

Post » Thu May 22, 2014 11:08 pm

Is this what your looking for ?
You do not have the required permissions to view the files attached to this post.
What I know would fill a Book , what I don't know would fill a Library
B
37
S
12
G
29
Posts: 331
Reputation: 16,499

Post » Fri May 23, 2014 6:05 pm

Ah, I see what you did. You used a family variable. Interesting. (and thanks for your time creating that capx!)

But that's kind of a "manual" solution. Do you know if there's a way to do it without a variable? Like, is it possible to check for object type in a condition?

Something like "If Object-type is "box", do ..."
B
20
S
5
Posts: 80
Reputation: 1,408

Post » Fri May 23, 2014 6:44 pm

No there's not.
ImageImageImage
B
71
S
22
G
247
Posts: 3,756
Reputation: 137,558

Post » Fri May 23, 2014 8:49 pm

You can have the condition "Bulbasaur: Pick instance with UID Pokemon.UID" which is kind of like saying "if this Pokemon is a Bulbasaur".
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,670

Post » Sat Jun 07, 2014 5:09 pm

Ah nice! Exactly what I was looking for. It's a weird workaround, but it works fine.

Thanks, ramones!
B
20
S
5
Posts: 80
Reputation: 1,408

Post » Wed Apr 12, 2017 3:45 am

I had to use the two mentioned solutions at the same time.

Thnx a lot.
B
21
S
5
G
1
Posts: 13
Reputation: 1,729


Return to How do I....?

Who is online

Users browsing this forum: newt and 42 guests