How do I save in local storage?

0 favourites
  • 10 posts
From the Asset Store
Basic Plugins for Firebase Authentication, Realtime-Database, Firestore, Cloud Storage
  • Hi there,

    I'm creating a little game with level select like angry birds.

    To do this I follow step by step this tutorial ( to tell the truth I follow the original video tutorial because I don't mind to save highscore or collected stars; I want just the right animation on the sprite button of level select sheet) and all work fine; I just changed Go to layout event to manage multiple level selections.

    https://www.scirra.com/TutorialViewFresh.aspx?ID=1160

    The problem still saving using local storage considering also that I would make multiple worlds. At the end I will have 3 or 4 worlds with 12 levels each.

    In the original old topic I commented explaining better what I'm trying to do attaching also an image to better understand.

    Anyone can help me or share a capx example ?

    Thanks in advance.

  • Guys nobody can help me ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are many tutorials to help you with saving to local storage. You are probably looking to save the MaxAchievedLevel global variable. Take a look at this tutorial and save this variable instead of Score. https://www.scirra.com/tutorials/9440/h ... al-storage

  • There was a similar tread about this which I helped solved, here is a link to that

    viewtopic.php?f=147&t=192946&p=1130941#p1130941

    Also here is a screenshot of my game, where I'm using local storage to save and load date with array saved as json

    https://postimg.org/image/enyi4lp9x/

    I hope this will help.

  • Hi there,

    thanks for ther support.

    Basically withouth having stars on animation buttons sprite on the selectlevel layout (after achieving a level) I were able to store data.

    I try to explain : the player can take coin, gem, key (3 mandatory to go to next level) and has a score depending on enemies dead.

    So these are all global variabiles in mine eventgame sheet but I don't mind to save.

    Collectedstar (1 2 or 3) is a variable depending on score so, on how many enemies the player kills. At the moment score 5 = 1star 10 = 2stars 15 = 3stars

    On Selectlevel event sheet I put an Array that says wich frame , locked or unlocked or animations 1star, 2star , 3star has to have the spritebutton. So it is an array with one dimension and 5 column. In the selectlevel event sheet I have also a global variable that is currentlevelA

    When the player win, the action I put (in the event game sheet) in the array is: (line 49)

    player win -> array : set value currentlevelA to max(2+CollectedStar,levels.At(currentlevelA))

    I did all this following the video tut in the link I put above and all works fine I've just change somethings a little bit.

    I think I have to save currentlevelA and apply animation to the frame using the array but I'm not able to do ?

    imhotep22 I see your example but you call also some functions and I do not understand very well what they do, then I think you use also array for levels and should be interesting understand how do this for multiworlds because now I'm thinking just to vreate different copy (not duplicate) of select level sheets for each world.

    I put all the event for localstorage in the menuevent sheet because is the first of the app . I put also one event at the end of eventgame sheet to save currentlevelA data but it doesen't work (line 100) .

    Can you please be so kind to check the apk?

    Obviously it is a working in progress so just some levels bad done just to test. The player is at the end of layout so to finish fast.

    https://drive.google.com/open?id=0B5PJd ... lMtNllRTDg

    Thanks a lot.

  • In the link of capx I share I see that (because I was testing) I insert also some event of local storage in the eventselectlevel sheet so delete it.

  • Actually I created level system which is levels divided into areas 1,2 & 3 like world:

    Save system with star achievement: https://www.dropbox.com/s/vh3n39sk8z2dh ... .capx?dl=0

  • alextro thank you very much. I will check it asap

    Best regards

  • Hi there,

    thank you very much again to all. At the end I understand how to store with array. Now all work great.

  • Hi there,

    thank you very much again to all. At the end I understand how to store with array. Now all work great.

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