I helped to write this code.
You say “has the old entries in there as well”, but the trace code only returns the same 3 values.
1
Bird
154
Over and over again. That means that it isn’t adding to the array nor is it replacing it. It’s just reusing the same data over and over. The CollideTypesInto function only works on empty arrays, does it? That’s an annoying way of going about it, but I suppose it would take the same 1 line of code to clear the array whether it’s done by the engine or the user, so meh.
As to your solution, that seems like it would work well enough. But the idea was to only move it just enough to clear the impeding object, and it grabs as many objects as there are colliding to try and find the lowest (or, eventually, highest) y-position and move it slightly above or below that.
I’m not sure why I wanted it to work like that, since it it seems a lot of headache for a minor quirk of spawn placement, but I get tunnel-visioned sometimes. Really, I just wanted to know why this code wasn’t working before scrapping it for being stupid.
The final goal is just to avoid two objects spawning already colliding. But on a second thought, this code doesn’t even work for that because if it only checks on spawn it wouldn’t catch when a jet (which moves faster than a bird) spawns just after a bird and catches up to it before the player can react…it’s a pickle.