Modified _layer_position_to_world_position() and _world_position_to_layer_position() to accept arrays instead of separate coordinates, updated code to use this method.
Added _remove_array_item() helper to remove an item from an array by index.
Added object cleanup code to remove all destroyed objects.