[Solved]How do I localstorage loop create object

Get help using Construct 2

Post » Mon Nov 07, 2016 5:21 pm

hi, have some issues, im missing something here, but not sure what, can a keen eye look at this example from below?

its a basic local storage save when you are in a layout, then when u switch layouts, i dont have any sprites, in there, i just create based on a loop, set their value level based on loopindex, and then for each of them i should be able to fetch the data i saved previously, however it does it for 1 item, but not for others any thoughts?

Capx localstorage

click left to set the values for level/hiscore/score/stars/coins for that specific 1st level value, then it increases and so on

when you right click switches to layout 2 - where it spawns the objects, and tries to update the info based on saved data in layout 1

need help asap if possible, i could do it if i could be able to get the values "on item get" under the "on created ", but C2 doesn't allow 2 "one time triggers" under each other.

any different approach similar to what i did? without weird math stuff?

thanks in advance


nevermind i solved .........




Capx Fixed in case someone wants it.


Capx fixed 2 this calls all the data saved in layout 1 repeating basically the same loop and append the values and texts. hope you guys find it useful, now i can get further and create my "dynamic" unlimited level. :D
Last edited by gamecorpstudio on Mon Nov 07, 2016 5:47 pm, edited 3 times in total.
B
78
S
23
G
69
Posts: 1,354
Reputation: 44,027

Post » Mon Nov 07, 2016 5:32 pm

You can't generate dynamic names for the Get. Use an array to store your levels then save the whole array AsJSON, and load it the same way. There should be plenty of examples in the forum showing this.
ImageImageImage
B
71
S
22
G
259
Posts: 3,794
Reputation: 143,704

Post » Mon Nov 07, 2016 5:37 pm

blackhornet wrote:You can't generate dynamic names for the Get. Use an array to store your levels then save the whole array AsJSON, and load it the same way. There should be plenty of examples in the forum showing this.



i just did, however i dont know how dynamic they are ... but all i know is that its working, and all the texts, dont exists before in layout2 but they are created on start of layout. and all i have to do now, is to call the rest of the info the same way :) thanks for the reply though! much apreciated
B
78
S
23
G
69
Posts: 1,354
Reputation: 44,027


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 35 guests