Zorder equivalent in for a transform?

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
SuperbowserX
Veteran
Posts: 270
Joined: Sat Jan 07, 2017 3:09 pm
Contact:

Zorder equivalent in for a transform?

#1 Post by SuperbowserX »

To have my character avatars overlap the choice menu bars (rather than have them shadow the character's faces), I tried giving my transforms for the character icon position a zorder but it didn't work. Anyone have any ideas?

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Zorder equivalent in for a transform?

#2 Post by Divona »

Choice menu bars are part of the screen which is in "screens" layer, while character avatars are in "master" layer which is below "screens" layer. Z-order wouldn't help in this case, I'm afraid. What you could do is to a create a layer specifically for this character image to be on top of "screens" layer to have them overlap the UI.

See this thread on how to do it:
viewtopic.php?f=8&t=44125

EDIT: If I'm misunderstanding what you're trying to do exactly, then you meant that this character avatar is part of the choice menu screen already. Then, the draw sequence would be from top to bottom. If you move a code that adds the character avatar to be below the choice menu bars, then it should be shown on top.

Code: Select all

screen choice(items):
    style_prefix "choice"

    vbox:
        for i in items:
            textbutton i.caption action i.action

    ## Add character avatars here.
    add "character_avatar_1.png"
Completed:
Image

User avatar
SuperbowserX
Veteran
Posts: 270
Joined: Sat Jan 07, 2017 3:09 pm
Contact:

Re: Zorder equivalent in for a transform?

#3 Post by SuperbowserX »

No it wasn't that. What's going on here is that the way my character avatars are positioned, the shadow of the choice menu buttons overlaps on them. My objective is to make it so that my character avatars will always (in case of conflict) overlap the images. If that clears things up.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Zorder equivalent in for a transform?

#4 Post by Divona »

Does the shadow of the choice menu buttons are part of the choice menu button image? Could you confirm those character avatars are part of the screen code?
Completed:
Image

User avatar
SuperbowserX
Veteran
Posts: 270
Joined: Sat Jan 07, 2017 3:09 pm
Contact:

Re: Zorder equivalent in for a transform?

#5 Post by SuperbowserX »

Lemme elaborate :)

The menu choice image is the default one.

The menu choice code is unchanged.

Here are my codes for the character avatar positions.

Code: Select all

            transform left:
                size(137, 149)
                xpos 0.24
                xanchor 0.5
                ypos 0.45
                yanchor 0.5
            transform right:
                size(137, 149)
                xzoom -1.0
                xpos 0.76
                xanchor 0.5
                ypos 0.45
                yanchor 0.5
            transform farleft:
                size(137, 149)
                xpos 0.09
                xanchor 0.5
                ypos 0.45
                yanchor 0.5
            transform farright:
                size(137, 149)
                xzoom -1.0
                xpos 0.91
                xanchor 0.5
                ypos 0.45
                yanchor 0.5
Then, for showing the images, I just say "show john happy at left", "show john happy at farright" etc..

This is the image problem I'm having.

http://i.imgur.com/PYLVuej.png

My objective is to make it so that the character icon always appears over the choice menu buttons so that the shadow doesn't hit them.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: Zorder equivalent in for a transform?

#6 Post by Divona »

Yes, you will have to put those on another layer above the choice menu screen.

First, separate the choice menu screen to be in another layer below "screens" so it won't conflict with other screens.
Then define another layer to be on top of the choice menu screen. Let's call it "icons".

Code: Select all

define config.layers = [ "master", "transient", "choice", "icons", "screens", "overlay" ]
define config.choice_layer = "choice"
Now, when you show those character icons, show them on "icons" layer.

Code: Select all

show john happy onlayer icons at farright
Explanation
Z-order is only working within in own layer. For the sprite, that is the master layer. Choice menu itself is part of the screens, and show on screens layer, which is placed on top of the master layer. So the way to have anything to be on top the choice screen is to place them on another layer that is above the layer where choice screen is displayed.

References:
- config.layers
- config.choice_layer
- Show Statement (onlayer)
Completed:
Image

Post Reply

Who is online

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