Determine the Type of Child From a Family Click / Tap Condition

0

Stats

1,648 visits, 2,507 views

Tools

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 3 Feb, 2015. Last updated 19 Feb, 2019

I spent days scouring the forums trying to figure out how to determine exactly what type of object triggered the condition.

In my case, I have a family with many sprites, and I want to know exactly what sprite from that family was the trigger, and take an action based on it.

1) Create The Family and Add the Children

2) Create an Instance Variable for the Family called "type" as a text with no initial value

3) For each of the family's members, create an event for On Created that will set "type" to a value unique to that child.

4) You can later test this variable and perform actions based on it.

  • 0 Comments

Want to leave a comment? Login or Register an account!