How to remove multiple values ​​from an array

Summary logic:

Identify the index of the pressed cell in the array.

Clears all cells after that position in the array.

Updates the state of the last remaining cell in the array to Illuminated.

I’ve tried everything to make that logic work but I can’t get anything.

Thanks in advance

Can you post a screenshot of what you tried?
Can you add more context? What does the data represent?

What do you mean by “illuminated” ?

Have you tried the “Array Tools” extension? It has a lot of useful functions. It can return the position of a value if you don’t know it’s position. It also has a Splice action to remove part of an array.

The cell is an object, I have several that when generated save their object variable “id” in the matrix, and what I am trying to do is that when pressing a cell its animation changes and that of others, I already have arraytools but I don’t know much, I’m a

Array tools has various search functions that return the position of a value in an array. If it’s not found, it returns a value of -1. If it’s not -1 the you can use that number to remove that index from an array.

If the value might be in the array multiple times then it might be easier to go through the array with for each child or a repeat event and a variable for the index.

If multiple objects were involved then you would probably need a for each object.

Is the “matrix” an array?

What is happening? A little more context would help you get a quicker more accurate answer.

I already solved this problem, thanks I ended up solving it with a “per object” event together with a variable that counted the length of the array, so just subtract the index by the length and thus eliminate what it occupied from the array

1 Like