Pass family variable through layouts

Discussion and feedback on Construct 2

Post » Sat Apr 12, 2014 10:20 am

Hi to all !
It seems there is something about familiy variables.
Layout 1 holds a family full of sprites and this family has variables to it.
I need to display these variables in layout 2 but it seems that variable value don't pass from a layout to the next.
Do you have any explantion / solution for this ?
Thanks !
Laurent
B
32
S
14
G
5
Posts: 232
Reputation: 5,502

Post » Sat Apr 12, 2014 4:01 pm

the family variables are just a way to input the same variable into a bunch of instances without having to do it one by one. it also lets you manage those instances as a groups when needed. https://www.scirra.com/manual/142/families

however, as with all instances, their existence starts and ends with the layout. the only way to have permanent variables is by using Global Variables https://www.scirra.com/manual/83/variables

You could, however, store the instance variable, for later use, in a number of ways: You could use arrays, dictionaries, webstorage or global variables with numbers or even in JSON format to move the data from one layout into the next. (https://www.scirra.com/manual/108/array, https://www.scirra.com/manual/140/dictionary, https://www.scirra.com/manual/140/dictionary)

take your time to review the manual entries =)
B
43
S
12
G
6
Posts: 446
Reputation: 6,802

Post » Sat Apr 12, 2014 4:10 pm

Thanks @Sargas. That's a pretty neat answer to my problem.
I managed to solve my problem in a different way but your suggestions will help me for the rest of my work
B
32
S
14
G
5
Posts: 232
Reputation: 5,502


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 5 guests