How do I compare 2 arrays on X0 and X1?

0 favourites
  • 4 posts
From the Asset Store
Supports 1D, 2D, 3D arrays. Import and export arrays in JSON format
  • I have two arrays, I want to compare these 2 arrays and get back the Array 1 with the unique values.

    Array 1, XY:

    0, 1

    1, 1

    2, 2

    3, 3

    4, 4

    5, 4

    Array 2, XY:

    0, 1

    1, 1

    2, 3

    3, 2

    4, 4

    5, 4

    In this scenario it should give back the 2, 2 and 3, 3 from the Array 1. So it should give back the results where the position X0 and X1 together unique.

  • Can you give the example again but don't use co-ordinates as values so it's easier to work out what you want.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are two arrays with coordinates (x and y) and I would like to check which coordinates are not used in the first array. (If the coordinates are used I want to delete it.)

    If I think it well:

    I have to take the first row from the Array 2 and compare it with the full Array 1.

    • If there is a match delete it from the Array 1 and go to the next Array 2 row.
    • If there is no match go to the next Array 2 row.

    I hope it makes sense.

  • Sure you can grab the value from Array 2, then use the condition with Array 1 'array contains value'. If returns true then you'll have to find its location and delete that Array 1 row, assuming you meant to delete the row you said delete value so maybe you meant just replace it with ""(empty).

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