How do I check items ?

0 favourites
  • 4 posts
From the Asset Store
Custom Health Bar
$3.50 USD
30% off
Custom animated Health Bar - check youtube video to make it yourself
  • Hi,

    i would like to know if there is a way to check items in local storage in one action ?

    i have a lot of items to check

    thanks in advance

    http://www.hostingpics.net/viewer.php?id=321603items.jpg]

    http://img4.hostingpics.net/thumbs/mini_321603items.jpg[/img]

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Pass localstorage values to variables for comparison.

    If you have a lot of them you might want to consider storing them in a Dictionary, then storing the Dictionary.AsJSON as a localstorage value - instead of storing each value independently.

  • mrtumbles

    i was thinking that is possible to do it in one action

    for example > start of layout >> check items "highscore1,highscore2,highscore3 etc ..."

    but it's not working

  • Ooooh, I see what you mean. Yes! You can use a loop, and combine it with loopindex. Eg:

    On start of layout

    For "values" from 1 to <However many highscores you have>

    |-> Check item "highscore"&loopindex

    The [&] operator allows you to build a string, and [loopindex] places the step number of the current iteration of the loop.

    Bear in mind you will still need individual actions for each of the rest of the item checks, however, so I would recommend using a Dictionary to store the values, and passing the Dictionary.AsJSON only as a localstorage value.

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