i get Error #1010 when i use this while loop:
while (pos.length>0)
{
coo = pos.splice(Math.floor(Math.random() * pos.length),1)[0];
(pos_array[index]).x = coo.x;
(pos_array[index]).y = coo.y;
index++;
}
The error says: A term is undefined and has no properties.
What is wrong with my loop because I used the same loop for other programms and i got no such error.
Thank you for your attention.
Your while loop is breaking.
pos.length will never change and eventually
pos_array[index]will be out of bounds.When when you are out of bounds it is undefined.
So basically you are doing.
And just like the error says undefined has has no properties.
I can’t see how this loop ever worked.
Try this instead much cleaner