[solved]Making a black box on the right side of the screen

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
Cristiander
Regular
Posts: 33
Joined: Sat Mar 04, 2017 8:19 am
Contact:

[solved]Making a black box on the right side of the screen

#1 Post by Cristiander »

Haven't really got the hang of creating my own screens in Renpy yet and I'm running into this problem.
I want to make a black box with a specific size on the right side of my screen.


I made it work for the left side of the screen using this code:

Code: Select all

screen m_info_screen:
    zorder 1000
    frame:
        area(0,0,250,200)
        xanchor 0.0
        yanchor 0.0
        background Solid("#000000")
        
And then I tried adapting it for the right side, but it's not working

Code: Select all

screen m_info_screen:
    zorder 1000
    frame:
        area(1.0,0,250,200)
        xanchor 1.0
        yanchor 0.0
        background Solid("#000000")
        
The box appears, but off-screen. I've read about the area function and I understand how it works and why my code doesn't work, but I can't think of any other way to make it appear. I tried giving it a negative width, I tryed setting xpos as 1.0 - 250, but they're not working and I can't figure out how to make this box appear on the right side.


Any help? I'm sure there's a simple solution to this that I'm missing, but I just can't find it.
Last edited by Cristiander on Sat Oct 13, 2018 1:34 pm, edited 1 time in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Making a black box on the right side of the screen

#2 Post by Alex »

You mix fraction of a screen (1.0) and position in pixels (250). Try to use here config.screen_width variable that sets the width of a game screen, like

Code: Select all

screen m_info_screen:
    zorder 1000
    frame:
        area(config.screen_width-250,0,250,200)
        xanchor 0.0
        yanchor 0.0
        background Solid("#000000")
https://www.renpy.org/doc/html/config.h ... een_height

Cristiander
Regular
Posts: 33
Joined: Sat Mar 04, 2017 8:19 am
Contact:

Re: Making a black box on the right side of the screen

#3 Post by Cristiander »

Alex wrote: Sat Oct 13, 2018 12:32 pm You mix fraction of a screen (1.0) and position in pixels (250). Try to use here config.screen_width variable that sets the width of a game screen, like

Code: Select all

screen m_info_screen:
    zorder 1000
    frame:
        area(config.screen_width-250,0,250,200)
        xanchor 0.0
        yanchor 0.0
        background Solid("#000000")
https://www.renpy.org/doc/html/config.h ... een_height
Thank you! I didn't know how to get the screen width variable.

I would like to add this to the solution. The code below works as well and doesn't need the xpos to be an equation.

Code: Select all

screen m_info_screen:
    zorder 1000
    frame:
        area(config.screen_width,0,250,200)
        xanchor 1.0
        yanchor 0.0
        background Solid("#000000")
Seems changing the xanchor can actually flip the box, as long as the xpos in the area function is an INT variable and not a FLOAT variable.
I was trying to flip it before but since my xpos was 1.0 it refused to work, but now that my xpos is config.screen_width it works.

Post Reply

Who is online

Users browsing this forum: NeonNights