Families/Function/Bubbling Access Question

0 favourites
  • 2 posts
From the Asset Store
2D Cartoon bubble shapes icons and bubble pop animation
  • Hello everyone,

    First time posting, I've been reading the forums recently and using the excellent 'Function' plugin. I'm hung up on a process of trying to implement code re-use. I'm using (as a test) two objects 'Man' and 'Woman' within the 'Human' family. If you look at my existing code you'll see that I can very easily click on one of those two objects and retrieve their respective 'Age' variables, however I can only seem to do this by having individual functions within each click event. I'd love to further optimize this to allow clicking on any object within a family to bubble up their instance variables, however it seems that data retrieval cannot flow that way.

    With this issue I now would like to click any object within the family and be able to use the object name as a reference in the function plugin, such as "On click 'Human' " > send object "Man" as a parameter in function so I can write a generic method that could be utilized by any object within 'Human' based off of the initial object I clicked on, again trying to re-use code as much as possible.

    Any help would be appreciated, I am really stumped, I know there's got to be a solution but I cannot see it!

    Thanks in advance!

    C2 Capx file

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I figured out where my problem was! I realized that if I created separate family variables and used those instead I could get to the point I wanted. For some reason I thought the family variables were static.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)