Quick tip: Want to delete elements while iterating over an array? Go backward, start from the last element and work to the front.

If you go forwards, you'll:
❌Skip elements
❌Go out of bounds at the end

Not #GodotEngine specific, but implemented in Godot.
#indiedev #gamedev

@SanderVanhove i always create a "zombie" array containing the ids of the element to delete, on wich i loop backwards... your solutin should be more efficient, but it woukd be cool to measure the performance boost
@frankiezafe also a valid solution! I imagine that the performance increase will be very dependent on how many elements are to be removed.