How do I load game on start of layout invisible

Get help using Construct 2

Post » Wed Jul 05, 2017 2:10 pm

i make something like that ... 2.png?dl=0

imhotep22 wrote:On item exist is only trigger when you check for certain key, you need to add on start of layout -> local storage -> check item -> safe exist.

See the screenshot I send you, on it first I check if my 3 keys exist, and if they do I load the saved values from them, if you don't check for key the item exist will not trigger.
Posts: 61
Reputation: 807

Post » Wed Jul 05, 2017 2:59 pm

But you are still dying it wrong. The first event is good, you check if certain key exits, then on the second event if the key exits you load it into the variable you want, like example Score = Localstorage.item.value, in your event you get the value only to trigger item exits again.

The third event on item get is unnecessary. Forth one also does not make sense, you say as event the key does not exist and as action you are trying to set a key which does not exist in a first place.

The last event the load action has noting to do with local storage.

Why don't you fallow my screen shot I send you?

131 event is used to save the score in an array as json if the current score is bigger then the value in the array( on start all values in array are 0), you can change this condition on what ever you want, then the action saves the score in an array as json, you can also change this into a variable like set item "score" to Score( global variable)

then event 26 checks if the key's exist, if they do in event 27,28,29 I load their values into the array, and I call a function to set the high scores etc, you can use the same condition for your self to set the value of the variable.

Then in the end you add another event like if Score == 0 button set invisible, if Score == 1 button set visible.

You will just need 2 events to load the storage, and 1 to save it, you don't need more then that. And if you are still confused how local storage works I suggest you read the manual on it. Its bit complicated on start until you get used it.
Like my work? Fallow me on social media, and see my games on the arcade.
Posts: 298
Reputation: 5,402


Return to How do I....?

Who is online

Users browsing this forum: Taz and 6 guests