custom Displayable: how to add children in Screen language

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
PasswordIsntHunter2
Newbie
Posts: 19
Joined: Sun Jan 07, 2018 6:23 pm
Contact:

custom Displayable: how to add children in Screen language

#1 Post by PasswordIsntHunter2 »

I've read the example here on how to make a creator-defined Displayable. The example gives the Displayable an image child passed in as an argument:

Code: Select all

screen alpha_magic:
    add Appearing("logo.png", 100, 200):
        xalign 0.5
        yalign 0.5

label start:
    show screen alpha_magic

    "Can you find the logo?"

    return
How do I change the Displayable's definition so I can add children in a block statement, the way Screen language normally does:

Code: Select all

screen alpha_magic:
    add Appearing(100, 200):
        xalign 0.5
        yalign 0.5
        vbox:
            add "logo.png"
            add "logo2.png"
            /// buttons and things

label start:
    show screen alpha_magic

    "Can you find the logo?"

    return
In practice, I'll be adding a vbox with its own children defined using a for loop from the game's Python vars, so it's not easily defined outside of Screen language that I know of. How do I do this?

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: custom Displayable: how to add children in Screen language

#2 Post by trooper6 »

What you want to do, you can't even do in screen language.

A custom displayable is just that, a displayable, like an image. You can't give an image a vbox...so you can't give a custom displayable a vbox. If you just want a screen to fade in...call the screen with an ATL transition. You don't need a custom displayable for that.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]