oosyrag's Forum Posts

  • No, there is no option for fullscreen scaling that stretches your sprites unevenly.

    It is best to design by scale inner/outer in all cases. The one you use depends on if you want certain screens to be able to see more or less of your layout/extra space. If you don't care to fill that extra space with graphics, then use letterbox scale.

  • Localstorage can save any value/string, and Array.AsJSON is a string. Localstorage doesn't have anything on arrays in particular because it can be used with many things.

    Array.AsJSON is an array expression, and Load array is an array action, so you can read about them on the array page - https://www.scirra.com/manual/108/array

  • The string is the Array.AsJSON. Did you read the manual entry about localstorage?

    To retreive a key from local storage, you first check if it exists, then on exists, you get key. Then on get key, you can access it from localstorage.itemvalue.

  • The array has a "Load" action, which you put the JSON string into.

  • Ok I have no idea what is going on with all the layouts and event sheets but you have no "Get Item" action anywhere. Localstorage.ItemValue is nothing until you get an item, and put it in an event with an "On Item Get" condition.

  • On the second layout, you will need to once again check if key exists, then set your variable in an "On exists" event.

  • I'm going to assume you're relatively new to Construct 2, so first I'll direct you to the manual - https://www.scirra.com/manual/75/how-events-work, and hope you have done the tutorials.

    It's going to be a bit difficult if you're a traditional programmer moving to Construct, as you will find that a lot of things you are trying to do are simpler than you might think. Basically, Construct will take care of a lot of lower level stuff for you behind the scenes (such as everything you mention in the last paragraph).

    Specifically regarding your questions - In your event conditions, if you used "On Mouse clicked RedItemSprite", only the one you clicked on will be "picked", and any actions in that event will only apply to those instances that have been picked by the conditions specified.

    So if you're setting flags, only the instance you click on will be picked and have its flag set. You can use a seperate event that runs every tick to keep the instance with its flag set positioned under your mouse at all times. On release, you can reset the flag.

    Regarding limiting which of your instances can be "picked up" - there are many ways to do this, it is up to you to set the condition under which it can be interacted with. Another instance variable as a flag would do nicely. Another useful technique that comes in handy in a lot of cases is to use an invisible helper sprite. Place this invisible sprite over the ones you want to interact, and in the event that lets you pick up items, add the condition that your mouse has to be over this helper sprite. If not, then that event won't run.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You're missing quite a few steps. Read the manual entry, follow the tutorial. Localstorage is asynchronous - that means it doesn't run in the same time as your event sheet.

    [quote:1aql7znz]For example here is a flow to read the value of the key "score":

    Use the action Get item "score"

    A moment later, On item "score" get triggers

    In this trigger, use the ItemValue expression to read the item

  • System: Set HighScore to int(LocalStorage.ItemValue)

    NaN means Not a Number. The int() part is important, as it changes a string into a number.

  • Are you loading the score from localstorage only on start of layout? Make sure you are not doing it every tick.

  • You definitely need the localstorage "Check item exists" action somewhere.

  • It works.

    Loopindex does not work for the Array "For each xyz" condition.

  • Save your scores to local storage, rather than a global variable (or save to the global variable, and save the global variable to local storage).

    On start of layout, load scores from local storage (if they exist) to global variable.

    https://www.scirra.com/manual/188/local-storage

  • Most of the heavy lifting of parsing/string manipulation can be done in base C2 with the tokenat() expression.

    Where that gets too clunky, the regex() expressions should be able to cover any situation, given you're familiar with regex.