Boom = {}

function Boom.Create(me)
	SetPower(me,0)
end

function Boom.Update(me)

	--Circle effect 1
	if( GetLifetime(me) == 8)
	then
		for i = 0,7
		do
			child = CreateObject(me,"Boom1","PlayerFX", 0,15,1,false)
			--SetVelocity(child, -8,-1)
			dir = i * (math.pi * 2 / 8)
			SetVelocity(child, math.cos(dir),math.sin(dir))	
		end
	end

	--Circle effect 2
	if( GetLifetime(me) == 28)
	then
		for i = 0,7
		do
			child = CreateObject(me,"Boom1","PlayerFX", 0,15,1,false)
			--SetVelocity(child, -8,-1)
			dir = (i*2 + 1) * (math.pi * 2 / 16)
			SetVelocity(child, math.cos(dir),math.sin(dir))	
		end
	end

	--Final, double circle effect
	if(GetLifetime(me) == 48)
	then
		for i = 0,15
		do
			child = CreateObject(me,"Boom1","PlayerFX", 0,15,1,false)
			--SetVelocity(child, -8,-1)
			dir = (i*2 + 1) * (math.pi * 2 / 32)
			SetVelocity(child, math.cos(dir) * 3,math.sin(dir) * 3)	
		end
	end

	-- The randomly firing orbs
	if( GetLifetime(me) % 4 == 0 and GetLifetime(me) <= 48 and GetLifetime(me) >= 8)
	then
		for i = 0,3
		do
			child = CreateObject(me,"Boom2","PlayerFX", 0,15,1,false)
			--SetVelocity(child, -8,-1)
			randDir = math.random(0,31) * (math.pi * 2 / 32)
			SetVelocity(child, math.cos(randDir) * 8,math.sin(randDir) * 8)
		end
	end

	--End the game when finished
	if( GetLifetime(me) == 128)
	then
		--Quit()
	end

end