Example basic project
Arseniy Mesherakov hat diese Seite bearbeitet vor 2 Monaten

This is a very basic himmel script example, from which you can start your project! Keep in mind that this project developed for 1344x1008 resolution.

-- Best practice in Himmel is to load resources at script beginning. This would allow for faster redraw/moving textures, and also bypass some graphics bugs.

-- himmel uses a coroutines for execution, because it allows to stop execution of script. It useful when waiting for player input, for example.
-- Coroutine itself is a pseudo-thread.

function EventLoopCoroutine()
    dialogCoroutine = coroutine.create(function()
        loadCharacter("res/characters/Rin Mayuzumi/MA05AS.png", 0) -- Himmel uses dynamic arrays inside, so last argument works as index, and this is value by which you can access element. It works for characters and backgrounds.

        loadBackground("res/backgrounds/Backgrounds (SPHIA)/BG_B23E.png", 0)
        loadMusic("res/music/02 - Chaining.mp3")

        drawBackground(getScreenWidth()/2, getScreenHeight()/2, 2.0, 0)
        drawCharacter(getScreenWidth()/2, getScreenHeight()/2, 2.2, 0)
        playMusic()
        --for name definition, Himmel uses square braces. 
        dialogBox({
            "[Mayuzumi] I don't know who you are or why you're claiming to be Yukidoh Satoru, but you're definitely a liar.", 
            "[Mayuzumi] ...",
            "[Satoru] But... Rin...",
            "[Mayuzumi] I don't want to hear this nonsense anymore! Shouldn't we get out of here? Where are we, anyway?!"}, 
            {"Okay, I guess you're right...", "Maybe you've forgotten something?"}, 3)
        while isDialogExecuted() do 
            coroutine.yield() 
        end
        local answerValue = getAnswerValue() -- you can put getAnswerValue() direct into if statement.
        if answerValue == 1 then
            dialogBox({"[Mayuzumi] Shut up! Don't talk to me like we know each other!"}, {}, -1)
            while isDialogExecuted() do 
                coroutine.yield() 
            end
        end
        stopDrawBackground(0)
        stopDrawCharacter(0)
        stopMusic()
        local currentTime = getTime() -- this is used for better fade in effect, which may stop not smooth if coroutine not yielding.

        while getTime() - currentTime < 0.4 do
            coroutine.yield()
        end
        unloadBackground(0)
        unloadCharacter(0)
        while getTime() - currentTime < 0.4 do
            coroutine.yield()
        end
        unloadMusic()
    end)
end

-- Main loop, in which coroutine is checked for work. Raylib graphic drawing functions should be called either here for drawing every frame or in EventLoopCoroutine with coroutine.yield() so it would be shown properly for some time
 
function EventLoop()
    if dialogCoroutine and coroutine.status(dialogCoroutine) ~= "dead" then
        coroutine.resume(dialogCoroutine)
    end
end

EventLoopCoroutine()