how to put instance variable's value to arrays

Get help using Construct 2

Post » Mon Nov 02, 2015 9:45 am

how to put values of instance variables to arrays
Image
B
72
S
41
G
48
Posts: 686
Reputation: 34,288

Post » Mon Nov 02, 2015 9:51 am

I guess you would need an action like:

Array set at XY : sprite.instancevariable

If you could explain in more detail what you are after, the answer might become more precise..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Nov 02, 2015 10:09 am

i am doing a background selecting layout
when i click on 1st bg icon comes unlocked
everything is working fine
actually my purpose is
i want to save unlocked backgrounds icon
and for this i want to put instances into arrays so that i can save them in local storage
Image
B
72
S
41
G
48
Posts: 686
Reputation: 34,288

Post » Mon Nov 02, 2015 10:16 am

If the two are linked, wouldn't it be easier to set the instance variable based on the array value, so when loading the array from localstorage all youd have to do is call a function to set all instance variables from the array?
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Nov 02, 2015 10:21 am

m not getting this point
may be because my english is not gud
Image
B
72
S
41
G
48
Posts: 686
Reputation: 34,288

Post » Mon Nov 02, 2015 10:28 am

Image
B
72
S
41
G
48
Posts: 686
Reputation: 34,288

Post » Mon Nov 02, 2015 10:29 am

1- You want the instance variables in the array..
2- You want to save the array..
3- You want to load the array..
4- You want to set the instance variables from the array after loading..

So why not use 4 always, instead of setting the array values from the instance variables and setting the instance variables from the array values..
Seems to me like doing a job two times..

so on button clicked
> set array value
> call function "SetInstanceVariablesFromArray"

And

on localstorage item exist
> Array load from json localstorage.itemvalue
> Cal function "SetInstanceVariablesFromArray"
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Nov 02, 2015 10:45 am

how do i put array value
their is one x and other is value
what will put in x and what in value
Image
B
72
S
41
G
48
Posts: 686
Reputation: 34,288

Post » Mon Nov 02, 2015 10:59 am

Looking at your event-sheet, something like this should work:

x should be BG_VBL_Select
and
value should be Select_BG.AnimationFrame

so the event would look like this:

for each Select_BG
> set array at x = BG_VBL_Select : value = Select_BG.AnimationFrame

this event would only have to be triggered if anything changes, ofcourse..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Mon Nov 02, 2015 11:21 am

thanks mate
actually i have seen a buddy saying thanks mate
i don't know what's mate
but im saying to you
thanks mate
i'll try it
Image
B
72
S
41
G
48
Posts: 686
Reputation: 34,288

Next

Return to How do I....?

Who is online

Users browsing this forum: draiza and 8 guests