renpy/doc/cookbook/In-game Splashscreen

From Ren'Py Visual Novel Engine

Jump to: navigation, search

In-game Splashscreen

This special feature allows you to create a skippable set of image transitions, like an in-game movie. This may save you from creating a MPEG flux if you don't feel like it or if you find it too hard.

# In the usual init section, place all the images
# you will need for transitions and alpha transitions.
init:
    image hello = "myimage0.png" #change here the desired image name
    image world = "myimage1.png" #change here the desired image name
    image black = Solid((0, 0, 0, 255))

    ## This here is the flash effect transition
    $ flash = Fade(.25, 0, .75, color="#fff")

    # I won't lecture you about how to create good "video" scenes.
    # This depends entirely on your inspiration.
    # It is best you kept one file for your in-game splashcreen (IGS)
    # This will be better for future editing.

    #The idea here is to create a 2 image IGS
    #with some short music and a little flash effect.

# Let's create our IGS.
label OP:
    $ mouse_visible = False #Turns off the mouse cursor

    #Pause for 2 seconds, not necessary, but it's good for narration transitions
    $ renpy.pause(2.0)

    #Play a tune
    $ renpy.music.play('theme.ogg')

    #This here is tricky: it applies the transition effect,
    #plus the renpy.pause
    #Your first image will appear with a flash effect
    #and pause for 1.5 seconds

    scene hello
    with flash
    with Pause(1.5)

    #You can also use the pre-defined alpha
    #transitions already defined in the Ren'py build.

    scene world
    with fade
    with Pause(1.5)

    #You can also use animation effects such as Pan, particles...
    #You might eventually create an entire
    #animation studio if you're patient enough.

    scene hello
    with Pan((0, 0), (800, 300), 1.5)
    with fade
    with Pause(2.0)

    #Don't forget to stop the music or it will loop endlessly.
    $ renpy.music.stop(fadeout=1.0)

    #And return the mouse or you'll feel lost :)
    $ mouse_visible = True

    #outta the OP!
    jump next_scene


    # You will end here if you click or press space
label next_scene:

    #This little script here is necessary because of skipping,
    #the previous code might not have been read.
    python:
        if renpy.sound.is_playing(channel=7):
            renpy.music.stop()
        mouse_visible = True

    scene black
    "Hello world ('_')/~"
Personal tools