function EventLoopCoroutine()
    dialogCoroutine = coroutine.create(function()
        loadBackground("res/backgrounds/Backgrounds (Other)/BG_C01A.png", 0)
        loadBackground("res/backgrounds/Backgrounds (Cabin & Mountains)/BG_A10N.png", 1)
        loadBackground("res/backgrounds/Backgrounds (SPHIA)/BG_B05E1.png", 2)
        loadCharacter("res/characters/Hotori Suzukage/HO04AS.png", 0)
        loadCharacter("res/characters/Hotori Suzukage/HO07AS.png", 1)
        loadCharacter("res/characters/Keiko Inubushi/IN01AS.png", 2)
        loadAnimationUI("res/uifx/snow", "snow", 0.01)
        loadMusic("res/music/13 - Trickstar.mp3")
        local currentTime = getTime()
        while getTime() - currentTime < 1.5 do
            drawText("Alternative begin?", 100, 100, 30)
            coroutine.yield()
        end
        playMusic()
        drawBackground(getScreenWidth()/2, getScreenHeight()/2, 1.68, 0)
        drawCharacter(getScreenWidth()/2, getScreenHeight()/2, 2.1, 0)
        dialogBox({
            "[Hotori] I must do something about Leiblich.",
            "[Hotori] They've done so many terrible things to me.",
            "[Hotori] I have no idea how I successfully escaped their laboratory...",
            "[Hotori] ...Ah!",
        }, {})
        while isDialogExecuted() do
            coroutine.yield()
        end
        stopMusic()
        local currentTime = getTime()
        while getTime() - currentTime < 0.2 do
            coroutine.yield()
        end
        unloadMusic()
        stopDrawBackground(0)
        stopDrawCharacter(0)
        local currentTime = getTime()
        while getTime() - currentTime < 1.5 do
            coroutine.yield()
        end
        loadMusic("res/music/04 - Fear and Insanity.mp3")
        playMusic()
        playAnimationUI()
        drawBackground(getScreenWidth()/2, getScreenHeight()/2, 1.68, 1)
        dialogBox({
            "(Airplane HAL18 crashed at Mount Akakura.)",
        }, {})
        drawCharacter(getScreenWidth()/2, getScreenHeight()/2, 2.1, 1)
        dialogBox({
            "[Hotori] Am I... alive?",
            "[Hotori] I should find someone else alive... Please, I'm praying to God, someone else...",
            "[Hotori] (After an hour, I've come to the conclusion that no one else is alive here. I'll die here.)",
            "[Hotori] It's cold... I'll collapse soon...",
            "[Hotori] I don't want to die... without helping... someone...",
            "[Hotori] Sayaka... I'm... sorry...",
        }, {})
        while isDialogExecuted() do
            coroutine.yield()
        end
        stopMusic()
        local currentTime = getTime()
        while getTime() - currentTime < 0.2 do
            coroutine.yield()
        end
        unloadMusic()
        stopDrawCharacter(1)
        stopDrawBackground(1)
        stopAnimationUI()
        local currentTime = getTime()
        while getTime() - currentTime < 1.0 do
            coroutine.yield()
        end
        loadMusic("res/music/06 - Anima.mp3")
        playMusic()
        drawBackground(getScreenWidth()/2, getScreenHeight()/2, 1.68, 2)
        drawCharacter(getScreenWidth()/2, getScreenHeight()/2, 2.1, 2)
        dialogBox({
            "[Hotori] Huh? Where am I?",
        }, {})
        while isDialogExecuted() do
            coroutine.yield()
        end
        stopDrawCharacter(2)
        moveCamera(1000, getScreenHeight()/2, 1.0, 3.0)
        while isCameraMoving() do
            coroutine.yield()
        end
        moveCamera(300, getScreenHeight()/2, 1.0, 3.0)
        while isCameraMoving() do
            coroutine.yield()
        end
        moveCamera(getScreenWidth()/2+5, getScreenHeight()/2, 1.0, 3.0)
        while isCameraMoving() do
            coroutine.yield()
        end
        drawCharacter(getScreenWidth()/2, getScreenHeight()/2, 2.1, 2)
        dialogBox({
            "[Hotori] Isn't this... SPHIA?...",
            "[Hotori] It looks strangely familiar, for some reason.",
            "[Hotori] ...",
            "[Hotori] Everyone thinks I have DID. But I don't! Yet for some reason, I'm in the body... of Sayaka Yukidoh. And i can't speak... This would be tough.",
        }, {})
        while isDialogExecuted() do
            coroutine.yield()
        end
        stopDrawBackground(2)
        stopDrawCharacter(2)
        stopMusic()
        local currentTime = getTime()
        while getTime() - currentTime < 0.4 do
            coroutine.yield()
        end
        unloadMusic()
        unloadBackground(0)
        unloadBackground(1)
        unloadBackground(2)
        unloadCharacter(0)
        unloadCharacter(1)
        unloadCharacter(2)
        loadScript("scripts/SE06.lua")
    end)
end

function EventLoop()
    if dialogCoroutine and coroutine.status(dialogCoroutine) ~= "dead" then
        coroutine.resume(dialogCoroutine)
    end
end

setFont("res/InterTight-Regular.ttf")
EventLoopCoroutine()