pRed = GetFloatParam("Red", 255)
pGreen = GetFloatParam("Green", 255)
pBlue = GetFloatParam("Blue", 255)
pAlpha = GetFloatParam("Alpha", 1)

function init()
	local locations = FindLocations("")
	locposes = {}
	locwidth = {}
	locheight = {}
	for i=1, #locations do
		locposes[i] = GetLocationTransform(locations[i])
		locwidth[i] = math.random(20,30)
		locheight[i] = math.random(20,30) 
	end
	
	r,g,b = GetEnvironmentProperty("fogcolor")
	cloudtexture = LoadSprite("images/cloud.png")
end

function tick(dt)
	if GetFloat("game.map.fade") > 0.2 then
		for i=1, #locposes do
			if not GetBool("level.sandbox") then
				DrawSprite(cloudtexture, locposes[i], locwidth[i], locheight[i], pRed/255, pGreen/255, pBlue/255, pAlpha, true, false)
			else
				DrawSprite(cloudtexture, locposes[i], locwidth[i], locheight[i], r, g, b, pAlpha, true, false)
			end
		end
	end
end