Saveable game

0 favourites
  • 11 posts
From the Asset Store
five golem elements Sprites Sheet.Best for enemy or villain game characters.
  • <font face="Arial, Helvetica, sans-serif">Hey people! Well, i wanted to know if there's a way to make a saveable game, so that the player can close the game and play from where he stopped (or a checkpoint). If it's possible, how to do it?</font>

  • yes, but it's complicated <img src="smileys/smiley17.gif" border="0" align="middle" />

    you could store values into "webstorage," which will store data locally, but if user clears cache, it's gone.

    or you could use AJAX to connect to a server and store values on a server but that's more complicated...

  • Its pretty doable, Look at the local storage object.

    You save local keys,

    For example the players last x and y position, then on load button clicked load that key.

  • If you do as i did , your game won't be compatible with the arcade , also be sure to know that there is only 1 global checkpoint object , just copy this object and place the checkpoint as you want , and be sure to place them in order of copy

    You can do it with the webstorage plugin ( set LocalVariables )

    but..

    They have to save by clicking on a button

    Legend:S.C.= Webstorage Local Variable "SavedCheckpoint"

    example:

    ---On Exit Clicked : Set (Webstorage Local Variable "SavedCheckpoint") to LastCheckpoint

    ---On Checkpoint Touched by Player :

    -----------Pick instance 0 (First checkpoint) : Set LastCheckpoint to 1

    --- On PlayObject (Main-menu Play ) clicked :Set LastCheckpoint to S.C.

    ---------- If LastCheckpoint = 1 :

    ---------------Pick instance 0

    ---------------------------------- Spawn Player on Checkpoint

    Here ya go <img src="smileys/smiley2.gif" border="0" align="middle" />

    Note: if you dont understand anything just post the capx , i will help you edit it

    Also repeat this for all checkpoints

    (example for Checkpoint 2)

    -----------Pick instance 1 (add 1 for each checkpoint) : Set LastCheckpoint to 2 (add 1 for each checkpoints)

    ---------- If LastCheckpoint = 2 :(add 1 for each checkpoint)

    ---------------Pick instance 1 (add one for each checkpoint)

    ---------------------------------- Spawn Player on Checkpoint

  • Thank you all!

    Still i would apreciate if someone could tell me how to make the save with the Local Storage object, to save the Player.X and Player.Y in a checkpoint, and how to load it. <img src="smileys/smiley9.gif" border="0" align="middle" />

  • Extract from the how do I FAQ:

    Webstorage

        Save variables/example of use - LINK

        Other example of use of webstorage - LINK

  • Thank you!

    It worked! :D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Well i copied and pasted the events in my project, but if i try to make it by myself, i get NaN instead of the value :S

  • What source project are you talking about ? kbdmaster's ?

    Also be sure to check the webstorage reference in the manual to understand more about how to use the webstorage plugin.

  • I copied the events from tonycrew's project LINK and it worked, but if i try to chose the events by my own, i get this error :S

  • Kyatric

    I just imaginated script in my head and i transformed it into C2 language ... easy :)

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