0 votes

Hi,

I have an array that needs to be randomized, and after "x" is called I want to remove it from the array. How can I do this?

Thanks :)

in Engine by (12 points)

Do you want to pick and remove a random item out of a randomized array?
Or do you just grab and remove the first or last item of a randomized array?
I would recommend you to do the later, because then you could use Array.pop_*().
In the first case you could use Array.erase(val)

1 Answer

0 votes

I've actually asked a similar question not too long ago. Hope it helps :)
http://www.godotengine.org/qa/2547/how-to-randomize-a-list-array

by (262 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.