Unlock NEW Item ?

0 favourites
  • 4 posts
From the Asset Store
Unlock Levels, Worlds & skin plus add coins by watching ads
  • In my game I will have many items.

    For now I'm not using Arrays + Array Editor as I tried and find it organized but very confusing with the Ajax and Json codes in the event editor.

    .

    All the items will sit on a dedicated Event Sheet and Layout, and will be added to the game levels from there. Every Item will have it's own dedicated GROUP with the conditions needed for different affect.

    .

    I would like to know how can I make specific ITEMS that I choose to be LOCKED (not appear in the game by default) and only when the player will find them in the game, they will be UNLOCKED and from now on they will appear not only for the specific "RUN" but also for future games.

    .

    Basically, the more the player will play and found items, the more NEW Items he will find and be able to see in the game.

    .

    I didn't mess with SAVE SLOTS yet because I don't know how to approach it so ever single save slot will save the UNLOCKED Items as well and all the status and progress of a player.

    Any advice, help, guide, c3p file or even video-tutorial will be very appreciated as I'm still learning Construct 3 and best way for me is visual examples. Thanks ahead!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Save slots are for saving the entire game. In your case you need to use Local Storage.

    When a new item is unlocked, add its code (or ID or name) to an array (or dictionary) "UnlockedItems", and save it to local storage.

    On start of the game, retrieve this array from local storage.

    .

    Here is a demo I made for some other post:

    dropbox.com/s/1cz1k5x3teikbv5/DictionaryLocalStorage.capx

  • Thanks for the reply and example dop2000

    Since I found Array and Json and Ajax and all these are over complicated and confusing to me, for now I'm giving up on Arrays on my game and everything looks much more simple with groups and variables, easy for me to follow, organize and manage individual in each group.

    .

    Is there a simple way to do this with local variables?

    or should I use global for this since it's supposed to save the status of what item unlocked last time before the player quit the game.

    .

    In any case I don't know exactly how to approach this yet, but I'm curious to read for different ways than using Arrays.

    Thanks ahead, I appreciate your kind help.

  • I know they look and sound scary - AJAX, JSON, ARRAYS, OMG!! - but they are really not!

    Just start using them and you'll see. Download a few examples from the tutorials section, try changing some bits. You only need two or three lines of code to load something with AJAX, you don't even have to understand how it works, just copy them from someone else's project.

    Same with JSON - all you need is Array.AsJSON expression to convert array to string, and "Array load from JSON" to convert it back. Two lines of code! Again, you don't need to know anything about JSON, its format, structure etc.

    .

    You can save individual variables to Local Storage if you wish. But to save/load 20 variables you will need like 60 events!

    To save/load an array or dictionary with the same 20 values, you will only need 3 events. See what I mean?

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