0 Favourites

How do I load game on start of layout invisible

  • hi, how do i condition when user run first time game layout should not display load button (because load state dont exist)

    but when user save state during game and reload game on menu load button should be visible ?

  • If you are using local storage to keep the saves, on start on layout you can add a sub event that checks if a key exist in storage, if it does not reposition the load button somewhere out of the canvas like -200,-200.

  • Set the button invisible by default. Then use a variable test canLoad=false. Set canLoad=true when save game exists and use an event that tests canLoad and when true set button to visible. You can also use the same variable to enable/disable the button in case player can still click where it is hidden and activate it.

    You can also simply spawn the button at the coords you want, or move it on and off screen as needed instead of using invisible.

  • If you are using local storage to keep the saves, on start on layout you can add a sub event that checks if a key exist in storage, if it does not reposition the load button somewhere out of the canvas like -200,-200.

    im using Scirra save and condition 'load save from slot 'mysave'' but not local storage

  • Set canLoad=true when save game exists and use an event that tests canLoad and when true set button to visible.

    How make this condition?

    because in system conditions list i dont see this ?

  • You can keep a Boolean variable to see if there is a load state or not, but then again the value of the Boolean has to be kept in local storage because how else you will know if there is a load state or not( if you close the game Boolean resets to default value).

  • You can keep a Boolean variable to see if there is a load state or not, but then again the value of the Boolean has to be kept in local storage because how else you will know if there is a load state or not( if you close the game Boolean resets to default value).

    any tips how do this in event sheet?

  • Add the storage plugin to your game( its already in c2 you don't have to download anything).

    Then when the players presses the button to save the game add 2 extra actions, one toggle the Boolean from false to true, or if its an number toggle it from 0 to 1, then as another action select the local storage -> set item, add a key and the variable you wish to save.

    When all of this is done, on layout load check storage item for item(key) exits if the key exits then move the load button where ever you want it.

    Here how I did it on my game Confusion which you can find on the arcade

  • can you take look at this?

    On my side dont work,

    Add the storage plugin to your game( its already in c2 you don't have to download anything).

    Then when the players presses the button to save the game add 2 extra actions, one toggle the Boolean from false to true, or if its an number toggle it from 0 to 1, then as another action select the local storage -> set item, add a key and the variable you wish to save.

    When all of this is done, on layout load check storage item for item(key) exits if the key exits then move the load button where ever you want it.

    Here how I did it on my game Confusion which you can find on the arcade

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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.

  • i make something like that

    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.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)