function remove_explosions()
  explosion_particle_to_be_removed = sort(explosion_particle_to_be_removed)
  if table.getn(explosion_particle_to_be_removed) > 0 then
    for i = 1,table.getn(explosion_particle_to_be_removed) do
      table.remove(explosion_particle_angle,egg_splatter_to_be_removed[i]) 
      table.remove(explosion_particle_speed,egg_splatter_to_be_removed[i]) 
      table.remove(explosion_particle_time,egg_splatter_to_be_removed[i])
      table.remove(explosion_particlex,egg_splatter_to_be_removed[i]) 
      table.remove(explosion_particley,egg_splatter_to_be_removed[i])
    end
  end
  explosion_particle_to_be_removed = {}
end

function move_explosion()
  if table.getn(explosion_particle_angle) > 0 then
    for i = 1,table.getn(explosion_particle_angle) do
      explosion_particle_time[i] = explosion_particle_time[i] - 1
      if explosion_particle_time[i] <= 0 then table.insert(explosion_particle_to_be_removed,i) end

      explosion_particlex[i] = explosion_particlex[i] + (math.cos(explosion_particle_angle[i]) * explosion_particle_speed[i])
      explosion_particley[i] = explosion_particley[i] + (math.sin(explosion_particle_angle[i]) * explosion_particle_speed[i]) + space_warp / 4
    end
  end
  remove_explosions()
end

function create_explosion(ex,ey,amount)
  for i = 1,amount do
    table.insert(explosion_particle_angle,math.random(628) /100 - 3.14)
    table.insert(explosion_particle_speed,math.random(5))
    table.insert(explosion_particle_time,math.random(10) + 15)
    table.insert(explosion_particlex,ex)
    table.insert(explosion_particley,ey)
  end
end
