Couldn't find anything about that with search so I want to ask someone how this can be done.
Array: [
[["name0"],[0]],
[["name1"],[0]],
[["name2"],[0]],
[["name3"],[0]],
...
[["name9"],[0]]
][/code:2dye1v6a]and
[code:2dye1v6a]
Keyboard: On Space pressed
[Local text TempName = ""]
+[empty sub-event] -> System: Set TempName to Array.At(random(Array.Width))
+Array: For each XY element
+Array: Current value = TempName -> System: Create object Sprite at mouseX, mouseY
Sprite: Set name to Array.At(Array.CurX)
Array: Set value at (Array.CurX, 1) to 1[/code:2dye1v6a]
What it does is:
After pressing space key it generates random value from ArrayX and then sets this value as a Sprite "name" variable and changing (Array.CurX, 1) to 1
For example after pressing a key if random generate number 3 it will look like this
[code:2dye1v6a]Array: [
[["name0"],[0]],
[["name1"],[0]],
[["name2"],[0]],
[["name3"],[1]],
...
[["name9"],[0]]
][/code:2dye1v6a]
It all basic stuff but my question is:
How can I set random() event to select only from Array with value (Array.CurX, 1) = 0 ?
At start I'm selecting from ["name0","name1","name2","name3","name4","name5","name6","name7","name8","name9"]
After pressing space couple of times I get "name2" and "name5".
And now on pressing space I would like to select from ["name0","name1","name3","name4","name6","name7","name8","name9"]
For now I have event Array: Value at (Array.CurX, 1) = 0 -> Create sprite....
But then while pressing space it will still go through all array X objects, and after some time nothing will spawn but values in random will keep changing until it hits the one with (Array.CurX, 1) = 0.
In conclusion, my question.
How can I set Array.At(random(Array.Width)) with exclusion every key pressed?
Can't do simple "Array.At(random(Array.Width)-1") or "Array.Delete index "x" from X axis" because all values in Array are hardcoded and other stuff depends on them.