I’ve been struggling with accessing sprites within an array to use the .destroy() function and remove them from the screen.
Whenever I try to use something like myArray[i].destroy() it doesn’t seem to work.
Anyone got any examples?
I’ve been struggling with accessing sprites within an array to use the .destroy() function and remove them from the screen.
Whenever I try to use something like myArray[i].destroy() it doesn’t seem to work.
Anyone got any examples?
What doesn’t work?
If you use an array like that, you have to splice the destroyed game object out of the array.
Or you can use a group instead: group.remove(sprite, true, true).