Families/Function/Bubbling Access Question

Get help using Construct 2

Post » Sat Oct 06, 2012 1:06 am

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

B
17
S
5
G
4
Posts: 24
Reputation: 4,039

Post » Sat Oct 06, 2012 3:18 am

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.
B
17
S
5
G
4
Posts: 24
Reputation: 4,039


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests