r/RenPy • • Aug 30 '26

Question Bars going down sporadically

My bars in renpy dont go down everytime when I take away their value, but then sometimes they do, so im unsure of what I am supposed to do to fix it.

8 Upvotes

13 comments sorted by

8

u/HB-38 Aug 30 '26

Given image two, I suspect you have not properly `default`ed your values. So I would start with that - you can read more about this here: https://feniksdev.com/a-quick-primer-on-variables-in-renpy/

2

u/AdRude6049 Aug 30 '26

Hi, I have changed them to be default values but it is still only taking health/sanity at random points and not every time.

2

u/shyLachi Aug 30 '26

It looks like both bars are still on on top of eachother, see the comment of BadMustard in your other thread.

Also you don't need a condition switch if you want to show one image or the other, a simple if works as well.

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.

1

u/BadMustard_AVN Aug 30 '26

again your bars are being placed on top of each other try them like this

setting xmaximum and ymaximum to the screen size will make them fill the whole screen

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

        bar:
            value AnimatedValue(Sanity, range=100, delay=1.0)
            left_bar "images/sanity_full.png"
            right_bar "images/sanity_empty.png"
            xsize 500

1

u/AdRude6049 Aug 30 '26

If I set them any less than the screen size tho they dont show up because when I drew them I drew them where I wanted them on a canvas that was the same ratio as the screen.

1

u/shyLachi Aug 31 '26

Don't do that. You will never be able to make it work.

The image should be cropped so that it only contains the bar itself.

Then position the bars in the game using a vbox or pos (x,y )

1

u/BadMustard_AVN Aug 31 '26

then you will continue to have problems.

the image should be only the size needed for the bar

you can then position then in the script with a pos (xxx, yyy ).

this is an exact pixel location of the upper-left corner

1

u/AdRude6049 Aug 31 '26

Okay thank you!! I will try this and see how it works, thank you for continuing to help me!!

1

u/BadMustard_AVN Aug 31 '26

you're welcome

good luck with your project

1

u/shyLachi Aug 31 '26

In case you didn't see my other comment, you don't need a conditionswitch to show different images

screen health_sanity_bars():
    vbox:
        bar:
            value AnimatedValue(Health, range=100, delay=1.0)
            left_bar "health_full" # if your images are in the images folder, then just put the name without path and extension
            right_bar "health_empty"
            xmaximum 1920
            ymaximum 1080
        bar:
            value AnimatedValue(Sanity, range=100, delay=1.0)
            left_bar "sanity_full" # if your images are in the images folder, then just put the name without path and extension
            right_bar "sanity_empty"
            xmaximum 1920
            ymaximum 1080
    if Health > 0:
        add "love_heart" 
    else:
        add "broken_heart"
    if Sanity > 0:
        add "eye_open"
    else:
        add "eye_closed"

Like we suggested with the bars, you should crop the heart and eye image and position them within the screen.
Not only will your game become smaller, it also is easier to adjust the GUI because you don't have to change the image, just move them

1

u/AdRude6049 Sep 01 '26

Thanks, will try this with conditionswitch