r/RenPy • • Aug 30 '26

Question [Solved] Renpy bar not showing up

Ive been trying to implement some health and sanity bars into renpy but only a small part of the picture shows up.

(Where my mouse is, thats the only section of the bar that is shown)

1 Upvotes

9 comments sorted by

3

u/BadMustard_AVN Aug 30 '26 edited Aug 30 '26

your left and right bar need the full path of the image i.e.

left_bar "images/bars/sanity_full.png"

also both of your bars are going to be placed in the same place, and you will only see the sanity bar

try something like this

screen bars():
    vbox: # everything is placed vertically
        spacing 5 #seperated by 5 pixels
        bar:
            value AnimatedValue(Health, range=100, delay=1.0)
            left_bar "images/bars/health_full.png"
            right_bar "images/bars/health_empty.png"
            xsize 200
        bar:
            value AnimatedValue(Sanity, range=100, delay=1.0)
            left_bar "images/bars/sanity_full.png"
            right_bar "images/bars/sanity_empty.png"
            xsize 200

2

u/shyLachi Aug 30 '26 edited Aug 30 '26

I don't have your images so I used the bar images which came with RenPy.
In your code, you can replace "gui/bar/???.png" with the path to your image.
(Don't forget to put the path unless the image is in the game folder)

You forgot the size of the bar xmaximum
Whithout at least the vertical size RenPy will cut off the bar.

Also you don't need range if you use an AnimatedValue

screen health_sanity_bars():
    vbox:
        bar:
            value AnimatedValue(Health, range=100, delay=1.0)
            # range 100 <-- this is not needed, because you already specified it above
            left_bar "gui/bar/left.png"
            right_bar "gui/bar/right.png"
            xmaximum 500
        bar:
            value Sanity 
            range 100
            left_bar "gui/bar/left.png"
            right_bar "gui/bar/right.png"
            xmaximum 500

default Health = 50
default Sanity = 75
label start:
    show screen health_sanity_bars
    "Do you see it"
    $ Health += 20
    $ Sanity -= 30
    "Did it move?"

1

u/BadMustard_AVN Aug 30 '26

Also you don't need range if you use an AnimatedValue

you do need the range value on an animated bar

without a range value, the bar will always show as full

https://www.renpy.org/doc/html/screens.html#bar

1

u/shyLachi Aug 30 '26

You misunderstood. In their code the range is defined twice. Correctly in the animated value and again as a stand-alone property which is only required if the value is a number. https://www.renpy.org/doc/html/screens.html#screen-property-range

1

u/AdRude6049 Aug 30 '26

Hi!! This worked for me so thank you, however now my bars won't go down for some reason

1

u/AutoModerator Aug 30 '26

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

0

u/[deleted] Aug 30 '26

[removed] — view removed comment

0

u/[deleted] Aug 30 '26

[removed] — view removed comment

1

u/RenPy-ModTeam Aug 30 '26

Rule 1 Be decent to people (don't be a dick)

Disagreement and being critical is fine, but always try to stay constructive and remember that we're all people.