Posted: 5th Dec 2022 9:03
So I am creating Two different types of sprites from the same array.

They do not effect each other at all, but when I use them against another array then they have a effect.

So I have one array, backgrounds, and bombs.

If i use the bombs on a different array to explode them, it works.

But when I want to effect the background sprites in the same array nothing happens.

I have also come across this error when trying to delete my sprites in the array.

Only the first sprites in the array will delete, and then the other sprites type are ignored.

Am I missing something?

Edit>

I am adding them all in the array like from there different types

backgrounds.insert(Frames)
Posted: 5th Dec 2022 10:55
nly the first sprites in the array will delete, and then the other sprites type are ignored.


work from the end of the array to the start

+ Code Snippet
For  index = myArray.length to 0 Step -1
	
	//do your array stuff here from last to first
	
Next


when you remove items from an array it changes the size of the array and invalidates any indices in the loop, always work from last to first when removing items
Posted: 5th Dec 2022 11:15
PartTimeCoder

That makes good sense, I will remember this.

I just created a different array for them all to work together.

Thanks