Onlayer Command Screen Language vs Show Statement (solved)

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
User avatar
noeinan
Eileen-Class Veteran
Posts: 1153
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA
Contact:

Onlayer Command Screen Language vs Show Statement (solved)

#1 Post by noeinan »

Hello! I am working on integrating layered backgrounds into a moveable map. I have the single layer map working, but I was hoping to add a top layer. However, I'm not sure how to add layers when on a screen vs a show statement.

Documentation I've found so far...

http://sleepyagents.blogspot.com/2017/0 ... renpy.html
I started from this tutorial, but it only involves show statements, not adding images to screens.

https://www.renpy.org/doc/html/displayi ... html#layer
https://www.renpy.org/doc/html/config.h ... fig.layers
Documentation on layers, but again using show statements rather than screens.

viewtopic.php?t=42459
I found this forum thread, adding a different screen layer on top of the old screen layer, not allowing multiple layers on a single screen... Maybe this can only be done by making a new screen for each layer?



I added this line to the options file:

Code: Select all

    config.layers = [ 'zero', 'master', 'transient', 'screens', 'belowmid', 'midlayer', 'abovemid', 'overlay']
I've defined my map here, adding base_img and top_img instead of just img:

Code: Select all

    class TestMap:
        def __init__(self, map_grid, base_img, top_img, start_x, start_y):
            self.map = map_grid
            self.base_img = base_img
            self.top_img = top_img
            self.center_x = start_x
            self.center_y = start_y
And I've got my map screen set up to add two images instead of one:

Code: Select all

screen map_screen(cMap):

    on "show":
        action Hide("say")

    add "#000"

    $offset_x = 990 - (90 * cMap.center_x) + 45
    $offset_y = 540 - (90 * cMap.center_y) + 45

    add cMap.base_img:
        pos(offset_x, offset_y)
        onlayer belowmid

    add cMap.top_img:
        pos(offset_x, offset_y)
        onlayer abovemid
The problem is, onlayer doesn't seem to work inside of a screen. The syntax seems to work in script with a "show" command, but screen language doesn't respond properly. Is there a different syntax I can use here? Any help is greatly appreciated! I want to be able to walk behind trees and roofs :D
Last edited by noeinan on Tue Jan 08, 2019 4:02 am, edited 1 time in total.
Image

Image
Image

User avatar
noeinan
Eileen-Class Veteran
Posts: 1153
Joined: Sun Apr 04, 2010 10:10 pm
Projects: Ren'Py QuickStart, Crimson Rue
Organization: Statistically Unlikely Games
Deviantart: noeinan
Github: noeinan
Location: Washington State, USA
Contact:

Re: Onlayer Command Screen Language vs Show Statement

#2 Post by noeinan »

Got some advice from someone on Discord, it seems you can't have one screen with multiple images on different layers. Instead, I just made multiple screens and got it to work.
Image

Image
Image

Post Reply

Who is online

Users browsing this forum: Ocelot, Semrush [Bot]