use screen as scene background

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
Arkfour
Newbie
Posts: 5
Joined: Fri Sep 23, 2016 3:15 am
Contact:

use screen as scene background

#1 Post by Arkfour » Fri Sep 23, 2016 3:27 am

My game will centre around the protagonist's lair, which will feature several clickable features (city map for travel, bed to sleep, etc). The images for these features change quite dynamically (the dressmaker's dummy reflects the character's current superhero costume, and I want the lair to accumulate clutter and knick-knacks as the story progresses).

The problem is, I also want to show the lair as a non-interactive background. Is there anyway to call up a screen and then immediately abort, so it's not waiting for me to click on stuff?

Image

Thanks.

User avatar
warmsundae
Regular
Posts: 61
Joined: Tue Feb 24, 2015 9:51 pm
Skype: electriclan
Soundcloud: lanterny
Location: korea
Contact:

Re: use screen as scene background

#2 Post by warmsundae » Fri Sep 23, 2016 3:50 am

If it's just non-interactive, do you need to have it on a separate screen? Why not just show the image in the script?

Arkfour
Newbie
Posts: 5
Joined: Fri Sep 23, 2016 3:15 am
Contact:

Re: use screen as scene background

#3 Post by Arkfour » Fri Sep 23, 2016 5:57 am

The scene background isn't a single image. It will be made up of several interchangeable components, for example:
- The map will become covered in red string and sticky notes.
- The computer can be upgraded to something bigger than a laptop.
- The dressmaker's dummy will show off a costume.
- The wall above the bed will display posters, and various clutter will appear over time.

The interactive version of this screen has the bed, map, etc as imagebuttons, with the other decorative elements added as images.

There will also be times, however, when the characters will stand in this room and talk.

I'm very new to renpy, and still fumbling my way along. Is there some way to call a screen and then return without waiting for use interaction?
Should I make a copy of the Screen code where all of the elements are non-interactive?
If need be, I'll have to use a bunch of 'show' commands and try to replicate the lair that way, but once it's assembled as a screen, it seems a waste to have to code it all twice, in two different methods.

User avatar
warmsundae
Regular
Posts: 61
Joined: Tue Feb 24, 2015 9:51 pm
Skype: electriclan
Soundcloud: lanterny
Location: korea
Contact:

Re: use screen as scene background

#4 Post by warmsundae » Fri Sep 23, 2016 7:20 am

Oh, I'm probably not the best person to give you advice on programming. Especially for screens. But if it's used in a different way (from what I understand, one's interactive and one can be pulled up from time to time?), I don't think copying the code is a bad idea.

Arkfour
Newbie
Posts: 5
Joined: Fri Sep 23, 2016 3:15 am
Contact:

Re: use screen as scene background

#5 Post by Arkfour » Fri Sep 23, 2016 8:13 am

Thanks for your speedy replies, I think I have a solution.

I think I can use 'show screen' instead of 'call screen', and execution continues without waiting for user input from the screen.

Rather than make 2 versions, my screen definition then needs to know that it should display non-interactive versions of the map, bed, etc. I'm going to do this using a toggle variable before the 'show screen' command.

So my screen code will be sorta like:

screen lair:
add "scene_lair.png"
if interactive_mode==1:
imagebutton auto "bed.png" action Jump("bed")
else
add "bed.png"

...and then add the rest of the cosmetic stuff.

User avatar
warmsundae
Regular
Posts: 61
Joined: Tue Feb 24, 2015 9:51 pm
Skype: electriclan
Soundcloud: lanterny
Location: korea
Contact:

Re: use screen as scene background

#6 Post by warmsundae » Fri Sep 23, 2016 10:06 am

Hey, nice. Hope it works well.

Arkfour
Newbie
Posts: 5
Joined: Fri Sep 23, 2016 3:15 am
Contact:

Re: use screen as scene background

#7 Post by Arkfour » Sat Sep 24, 2016 7:15 am

Damn, still not QUITE there; my characters don't show up.

This just gives me my lair background, with no character:

Code: Select all

show screen lair_main
show miki_dress 
Does anybody know what I'm missing? Is there some command to display a character in front of a screen?

User avatar
indoneko
Miko-Class Veteran
Posts: 528
Joined: Sat Sep 03, 2016 4:00 am
Contact:

Re: use screen as scene background

#8 Post by indoneko » Sat Sep 24, 2016 8:12 am

Arkfour wrote:Damn, still not QUITE there; my characters don't show up.

This just gives me my lair background, with no character:

Code: Select all

show screen lair_main
show miki_dress 
Does anybody know what I'm missing? Is there some command to display a character in front of a screen?
I don't know much about screens, but how about using layers? perhaps something like :

Code: Select all

show miki_dress onlayer YourLayer with dissolve
"YourLayer" is the topmost layer where you put your character sprites, and you need to define it first in your init section like this :

Code: Select all

$ config.top_layers = ["YourLayer"]
$ config.clear_layers = ["YourLayer"]
Hope it works... but if not, please don't hate me~ :lol:
My avatar is courtesy of Mellanthe

Arkfour
Newbie
Posts: 5
Joined: Fri Sep 23, 2016 3:15 am
Contact:

Re: use screen as scene background

#9 Post by Arkfour » Sat Sep 24, 2016 10:54 am

Aha! Yes! Success! Many thanks.

I've only half-implemented the solution, because it turns out I can just show my characters 'onlayer screens' and that works fine.

Thanks again!

User avatar
SypherZent
Veteran
Posts: 331
Joined: Fri Sep 02, 2016 3:14 am
Completed: Multiverse Heroes, Space Hamster in Turmoil
Soundcloud: Chrysopoeist
Location: Puerto Rico
Contact:

Re: use screen as scene background

#10 Post by SypherZent » Sun Sep 25, 2016 12:08 am

If you're still having difficulty trying to achieve what you need, you can also check the Statement Equivalents.
https://www.renpy.org/doc/html/statemen ... lents.html

The screens file basically runs python, while the script file uses an intermediary sort of syntax exclusive to renpy.
You can still use renpy commands in the screens file, by using statement equivalents.

Not to mention, you can call screens from other screens and have buttons on those screens hide the called screens.
The statement equivalents are probably not even necessary because you can really do a LOT with the screens stuff alone!

Here's an example:

Code: Select all

screen int_popup(dir, spot):
    if spot == 1:
        $ the_spot = 0.15
    else:
        $ the_spot = 0.23

    if dir == "up":
        add "int_up.png" xalign 0.0 yalign the_spot
    else:
        add "int_down.png" xalign 0.0 yalign the_spot
In this example, I'm basically just creating a popup screen so I can display a popup whenever the stat goes up or down.
In the script I use this:

Code: Select all

show screen int_popup("up",1)
"Your intelligence went up!"
hide screen int_popup
This is a very, very basic example. But I believe you can use screens to show/hide sprites from other screens in the same way.

Not to mention, this code can be more elaborate to include another parameter to define which stat, so that you don't have str_popup, int_popup, wis_popup, dex_popup, etc. Instead, you could define it as popup_(type, dir, spot).

I use the spot parameter basically because I want to display multiple popups, so the xalign changes to make sure both can appear at once and not occupy the same location.

This is probably a poor example, as it can be further optimized and made more sophisticated, but I hope it helps at least. ^^
Creator of Multiverse Heroes & Space Hamster in Turmoil

Want me to code your game?
Check my services thread!

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], Ocelot, zyric