local function onBegin()
	if not getFlag("IvoryBoatSeen") then
		disableMovement ()
		getLevel().SaveQuitDisabled = true
		setFlag("IvoryStartBoat", true)
		player.ForceCameraUpdate = true
		wait(2.1)
		setFlag("BoatlockOne", true)
		wait(0.3)
		shake(y,1000)
		setFlag("IvorySkipped", true)
		wait(3.5)
		setFlag("BoatlockOne", false)
		wait(0.3)
		shake(up,1000)
		wait(10.1)
		walkTo(-70)
		jump(1.8)
		runTo(-30)
		setFlag("IvoryBoatSeen", true)
		player.ForceCameraUpdate = false
		enableMovement ()
		getLevel().SaveQuitDisabled = false
	end
    end

local function onEnd(level, wasSkipped)
	if wasSkipped then
		setFlag("IvorySkipped", false)
        	instantTeleportTo(-30, 64)
		enableMovement()
		setFlag("IvoryBoatExists", true)
		getLevel().SaveQuitDisabled = false
		player.ForceCameraUpdate = false
		getRoom().Camera.Position = player.CameraTarget + vector2(115.8, 0)
	end
end

return onBegin, onEnd