function sort(array)
  for i = 1, table.getn(array) do 
    for j = i + 1, table.getn(array) do 
      if( array[j] > array[i] ) then
        tmp = array[j]
        array[j] = array[i]
        array[i] = tmp
      end
    end
  end
  return array
end

function collision(x,y,w,h,x2,y2,w2,h2)
  if x2<x+w and x2+w2>x and y2+h2>y and y2<y+h then 
    return true 
  else 
    return false 
  end
end