web storage and array

  • small help needed... (mine first encounter with arrays)

    iw set my array with height 2

    0 (date,image)

    1 (date,image)

    2 (date,image)

    etc

    how can i loop through array and check in my first value (date) if its smaller than current date (in my variable) and to delete that item?

    tnx!

  • anyone?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Are you trying to compare every element with the value, or just the first one?

    If you are just comparing the first, you just need do a comparison from value to that y element since you are using height. That if true, just set that date as the new value in that element.

    If you are comparing every element, you can create a For loop and use a variable based on how many elements you have, so it will check every one. For example, there are 5 y elements, or 4 in y heights. So For Y < 5. Start with Y at 0 and than in the end of each action, add one to Y.

  • rekjl

    Thanks for answering

    Currently i am using

    Array for each X element

    Array current value < my date / ArrayBasket.CurX = 0

    and this works good for that X but i need to set to 0 and that Y also and this is where im stuck...

    a im comparing (searching) only for X (and not Y) but i need to delete (set to 0) also the same Y

  • array for each x element

    array current value < my date:

    * set array at (array.curx, 0) = 0

    * set array at (array.curx, 1) = 0

    setting to 0 is not deleting, but I guess you know that ^^

  • Really sorry Irina cause I don't really understand what you are trying to achieve. Do you have an example capx? If you do maybe I can understand it better and can try to modify the capx for you.

  • mindfaQ

    Thanks, thats what i was loking for!!!

    rekjl

    thank you also!

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