Snippets

SinnyStar [Ren'Py] Namebox and textbox style groups v2

Created by Sinny Star
init -2 python:
    # Default style
    persistent.style = "A"

    # namebox1A = "Namebox1A.png"
    namebox1A = Frame("#f00",0,0)
    namebox2A = Frame("#00f",0,0)
    textbox1A = Frame("#ff0",0,0)
    textbox2A = Frame("#0ff",0,0)

    namebox1B = Frame("#f008",0,0)
    namebox2B = Frame("#00f8",0,0)
    textbox1B = Frame("#ff08",0,0)
    textbox2B = Frame("#0ff8",0,0)

init:
    #1A
    style namebox1A_window is say_who_window:
        background namebox1A
    style textbox1A_window:
        background textbox1A
    #1B
    style namebox1B_window is say_who_window:
        background namebox1B
    style textbox1B_window:
        background textbox1B
    #2A
    style namebox2A_window is say_who_window:
        background namebox2A
    style textbox2A_window:
        background textbox2A
    #2B
    style namebox2B_window is say_who_window:
        background namebox2B
    style textbox2B_window:
        background textbox2B

screen say(who, what, side_image=None, two_window=False,
    # Namebox style variable
    namebox_style="say_who_window",
    # Textbox style variable
    textbox_style="say_what_window"
):

    vbox:
        style "say_two_window_vbox"
        if who:
            window:
                # Style var from character and append style setting
                style_group namebox_style+persistent.style

                text who:
                    id "who"

        window:
            # Style var from character and append style setting
            style_group textbox_style+persistent.style

            vbox:
                style "say_vbox"

                text what id "what"                

    frame:
        has vbox
        text "Textbox Style"
        textbutton "Style A" action SetField(persistent, "style", "A")
        textbutton "Style B" action SetField(persistent, "style", "B")
1
2
3
4
5
6
7
8
9
# Declare characters used by this game.
define a = Character('Alice', show_namebox_style="namebox1", show_textbox_style="textbox1")
define b = Character('Bob', show_namebox_style="namebox2", show_textbox_style="textbox2")

# The game starts here.
label start:
    a "I'm [a]."
    b "I'm [b]."
    return

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.