Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Ren'Py All-In-One GUI Template

A sample project with all those bells and whistles · By tofurocks

Newbie Help Request

A topic by Aulos created Dec 20, 2022 Views: 725 Replies: 2
Viewing posts 1 to 2

Hi! Not sure if you'll see this, but thanks for the great template! I found it after I built some of my game, so I've been trying to transfer the things I want over, but I've run into some problems. I hope it's okay to ask for help here.

1. The font sizing options have disappeared for my chosen default font (NotoSans). They appear for Hyperlegible though

2. Line Spacing doesn't seem to change for either font (NotoSans AND Hyperlegible)

3. And not a problem, but I'm not good at coding - I'm not sure how to make the custom screenshakes, and $ shake () yields only one workable shake. I don't know how to make the screenshakes on by default either


This is the front end:

And this is the backend for the Preferences screen with what I hope is the most relevant part of code:

And this is the backend in my GUI.rpy:


I tried to copy the formats used, but the font sizing still won't show up. For the line spacing, I copied the part of the template code over from preferences.rpy, but I didn't see a difference in my game (I only saw it in the web demo).  I've also tried changing "style say_dialogue" line in screens.rpy by adding in 

    line_spacing gui.preference("dialogue_spacing", 2)

But it hasn't worked. If you could help me troubleshoot this, I'd much appreciate it!

Thanks!

Developer

Hi there, thanks for your patience over the holidays! Just to be sure, which version of the template are you using? We hope these answers are still needed.

1. Your persistent.typeface for notosans-regular is not the same between gui.rpy and screens.rpy, therefore Ren'Py isn't recognizing when you have the typeface set to Noto Sans. The easiest way to fix this is by changing the line in Font Size to if persistent.typeface == "/gui/font/notosans-regular.ttf"

2. To ensure that the Line Spacing setting takes effect, please add the following to your say screen styles in screens.rpy.

style say_dialogue:
    properties gui.text_properties("dialogue")
    xpos gui.dialogue_xpos
    xsize gui.dialogue_width
    ypos gui.dialogue_ypos
    adjust_spacing False
    line_spacing gui.preference("dialogue_spacing", 2)

3. For the custom screenshakes, please note that $ shake() only corresponds to the small_shake in the template. Other strengths are at the bottom of the below block.

init python:
    # Shakes the screen. To use, put
    # $ shake()
    # inline. For other uses, simply do a check inline for ATL statements,
    ## or a ConditionSwitch for shaky images.
    def shake():
        if persistent.screenshake:
            # renpy.with_statement(hpunch)
            ## Uncomment the one above if you prefer the default screenshake
            renpy.with_statement(small_shake)
        else:
            renpy.with_statement(fade)
            ### OPTIONAL: Show a different effect if screenshake is turned off.
### Custom Screen Shake Effect by BáiYù
init:
    python:
        import math
        class Shaker(object):
            anchors = {
                'top' : 0.0,
                'center' : 0.5,
                'bottom' : 1.0,
                'left' : 0.0,
                'right' : 1.0,
                }
            def __init__(self, start, child, dist):
                if start is None:
                    start = child.get_placement()
                #
                self.start = [ self.anchors.get(i, i) for i in start ]  # central position
                self.dist = dist    # maximum distance, in pixels, from the starting point
                self.child = child
            def __call__(self, t, sizes):
                # Float to integer... turns floating point numbers to
                # integers.
                def fti(x, r):
                    if x is None:
                        x = 0
                    if isinstance(x, float):
                        return int(x * r)
                    else:
                        return x
                xpos, ypos, xanchor, yanchor = [ fti(a, b) for a, b in zip(self.start, sizes) ]
                xpos = xpos - xanchor
                ypos = ypos - yanchor
                nx = xpos + (1.0-t) * self.dist * (renpy.random.random()*2-1)
                ny = ypos + (1.0-t) * self.dist * (renpy.random.random()*2-1)
                return (int(nx), int(ny), 0, 0)
        def _Shake(start, time, child=None, dist=100.0, **properties):
            move = Shaker(start, child, dist=dist)
            return renpy.display.layout.Motion(move,
                          time,
                          child,
                          add_sizes=True,
                          **properties)
        Shake = renpy.curry(_Shake)
    $ small_shake = Shake((0, 0, 0, 0), 1.0, dist=10)
    $ short_shake = Shake((0, 0, 0, 0), 1.5, dist=15)
    $ med_shake = Shake((0, 0, 0, 0), 2, dist=20)
    $ long_shake = Shake((0, 0, 0, 0), 2.5, dist=25)

To utilize the other strengths, please copy the base def shake(): definition and rename it appropriately. Additionally, the default persistent.screenshake variable is located at the top of accessibility.rpy.

Let us know if you have any other questions or encounter any other issues.

I'm using v2.6 of the template, but I've tried everything you said, and it all worked!

Thank you very much for the help!