local badeline
local level = getLevel()

function onBegin()
	disableMovement()
	disableRetry()
	waitUntilOnGround()
	walkTo(-5288)
	player.Facing = getEnum("Celeste.Facings", "Right")
	wait(0.45)
	
	--coroutine.yield(level:ZoomTo(vector2(168, 90), 1.15, 1.5)) -- THESE COORDINATES ARE WRONG AND IDK WHY
	wait(0.2)
	player.DummyAutoAnimate = false
	player.Sprite:Play("lookUp")
	wait(1.2)
	player.DummyAutoAnimate = true
	wait(0.4)
	level.Displacement:AddBurst(player.Position, 0, 8, 32, 0.5)
	coroutine.yield(player:CreateSplitParticles())
	badeline = celeste.BadelineDummy(player.Position + vector2(8, -10))
	badeline.Sprite.Scale = vector2(1, 1)
	level:Add(badeline)
	wait(0.2)
	player.Facing = getEnum("Celeste.Facings", "Right")
	playSound("event:/char/badeline/maddy_split", player.Position)
	coroutine.yield(badeline:FloatTo(player.Position + vector2(20, -24), 1, false, false, true))
	badeline.Sprite.Scale = vector2(-1, 1)
	wait(0.1)
	say("CC_Aques_isle_intro")
	if choice("CC_Aques_isle_promptA","CC_Aques_isle_promptB") == 1 then -- you're right
		if getFlag("FindTheTruth_Zanguango") then
			say("CC_Aques_isle_good_choiceYouRight")
			if choice("CC_Aques_isle_promptA2","CC_Aques_isle_promptB2") == 1 then
				say("CC_Aques_isle_letsFindMyself")
				setFlag("Isle_FindMyself")
			else
				say("CC_Aques_isle_letsGetOut")
				setFlag("Isle_GetOut")
			end
		else
			say("CC_Aques_isle_bad_choiceYouRight")
			if choice("CC_Aques_isle_bad_choicePeak","CC_Aques_isle_bad_choiceTakeCare") == 1 then
				say("CC_Aques_isle_bad_choicePeakDialog")
				setFlag("Isle_Accident")
			else
				say("CC_Aques_isle_bad_choiceTakeCareDialog")
				if choice("CC_Aques_isle_promptA2","CC_Aques_isle_promptB2") == 1 then
					say("CC_Aques_isle_letsFindMyself")
					setFlag("Isle_FindMyself")
				else
					say("CC_Aques_isle_letsGetOut")
					setFlag("Isle_GetOut")
				end
			end
		end
	else -- lied
		if getFlag("FindTheTruth_Zanguango") then
			say("CC_Aques_isle_good_choiceLied")
			choice("CC_Aques_isle_promptC2")
			setFlag("Isle_IDontNeedYou")
			say("CC_Aques_isle_good_IDontNeedYou")
		else
			say("CC_Aques_isle_bad_choiceLied")
			setFlag("Isle_NothingMatters")
		end
	end
	coroutine.yield(badeline:Vanish())
	coroutine.yield(level:ZoomBack(0.6))
	wait(0.6)
end

function onEnd()
	setFlag("Isle_Seen")
	enableMovement()
	enableRetry()
end