function onBegin()
	disableRetry()
	playSound("event:/CrossoverCollab/Xelk1/SFX/LevelComplete")
	setFlag("endCirclePre",true)
	wait(0.125)
	setFlag("endFadingBeams",true)
	wait(0.25)
	setFlag("endCircleA",true)
	wait(0.1)
	setFlag("endCirclePre",false)
	setFlag("endCircleB",true)
	wait(0.1)
	setFlag("endCircleC",true)
	wait(0.1)
	setFlag("endCircleParticlesA",true)
	setFlag("endFadingBeams",false)
	wait(0.1)
	setFlag("endCircleParticlesB",true)
	wait(0.1)
	setFlag("endCircleParticlesC",true)
	wait(0.05)
	setFlag("endCircleA",false)
	wait(0.1)
	setFlag("endCircleB",false)
	wait(0.1)
	setFlag("endCircleC",false)
	wait(0.25)
	setFlag("endCircleParticlesA",false)
	wait(0.1)
	setFlag("endCircleParticlesB",false)
	wait(0.1)
	setFlag("endCircleParticlesC",false)
	wait(0.65)
	setFlag("endSongFloppyDiskOutline",true)
	if getFlag("song6coin1") then
		setFlag("song6coin1Display",true)
	end
	wait(0.5)
	
	while true do
		if (celeste.Input.Jump.Pressed or celeste.Input.DashPressed or celeste.Input.CrouchDashPressed or celeste.Input.MenuConfirm.Pressed) then
			onEnd()
			setFlag("ExitMapFinal",true)
		end
		wait()
	end
end

function onEnd()
	setFlag("endFadingBeams",false)
	setFlag("endCirclePre",false)
	setFlag("endCircleA",false)
	setFlag("endCircleB",false)
	setFlag("endCircleC",false)
	setFlag("endCircleParticlesA",false)
	setFlag("endCircleParticlesB",false)
	setFlag("endCircleParticlesC",false)
	setFlag("endSongFloppyDiskOutline",false)
	setFlag("song6coin1Display",false)
end