Brightness in game settings

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
User avatar
Andredron
Miko-Class Veteran
Posts: 535
Joined: Thu Dec 28, 2017 2:37 pm
Completed: Kimi ga nozomu renpy-port(demo), Albatross Koukairoku(demo)
Projects: Sisters ~Natsu no Saigo no Hi~(renpy-port)
Location: Russia
Contact:

Brightness in game settings

#1 Post by Andredron » Fri Aug 26, 2022 9:25 am

Write this code first

Code: Select all

default persistent.brightvar = 0.0

init:
    transform bright:
        matrixcolor BrightnessMatrix((persistent.brightvar))
Further, for convenience, in the settings we will write a bar where you can change the values

Code: Select all

vbox:
    xsize 525
    label _("Brightness")
    bar value FieldValue(persistent, "brightvar", range=2.0, offset=-1, style="slider")

Registration of all code, check its performance

Code: Select all

default persistent.brightvar = 0.0

init:
    transform bright:
        matrixcolor BrightnessMatrix((persistent.brightvar))



label start:
    scene ball10 at bright
    "Hi"
    scene ball50 at bright
    "test"
     return
As you can see, the code works, but the problem is highlighted that a lot of unnecessary writing will have to be written, in order to avoid this, we will write such a function

Code: Select all

init python:
   def myShow( *args, **kwargs ):
        if not "at" in kwargs: kwargs["at_list"] = []
        kwargs["at_list"].append(bright )
        renpy.show( *args, **kwargs )
   config.show = myShow
Or:

https://www.reddit.com/r/RenPy/comments ... s_setting/
I'm writing a Renpy textbook (in Russian). https://disk.yandex.ru/i/httNEajU7iFWHA (all information is out of date) Update 22.06.18

Help me to register in QQ International

Honest Critique

Post Reply

Who is online

Users browsing this forum: No registered users