web storage and array

Get help using Construct 2

Post » Sat May 09, 2015 3:36 pm

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!
B
30
S
13
G
2
Posts: 747
Reputation: 5,502

Post » Sun May 10, 2015 6:16 am

anyone?
B
30
S
13
G
2
Posts: 747
Reputation: 5,502

Post » Sun May 10, 2015 6:25 am

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.
B
46
S
23
G
31
Posts: 693
Reputation: 20,637

Post » Sun May 10, 2015 7:03 am

@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

:(
B
30
S
13
G
2
Posts: 747
Reputation: 5,502

Post » Sun May 10, 2015 7:12 am

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 ^^
Visual Novel 'Engine' in 100 Events
if you ever have to choose between buying Construct 2 on scirra.com or on Steam, read this: Review
B
22
S
9
G
1
Posts: 788
Reputation: 3,788

Post » Sun May 10, 2015 7:19 am

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.
B
46
S
23
G
31
Posts: 693
Reputation: 20,637

Post » Sun May 10, 2015 6:44 pm

@mindfaQ
Thanks, thats what i was loking for!!! :)

@rekjl
thank you also!
B
30
S
13
G
2
Posts: 747
Reputation: 5,502


Return to How do I....?

Who is online

Users browsing this forum: irina and 6 guests