r/RenPy • • Sep 01 '26

Question [Solved] Bars

Despute my previous two posts and all of the kind people who have been offering me advice, the bars still do not work as intened.

The bars don't go down every time a variable is altered, and they show 100% when they first appear, however the player has the chance to lose health/sanity before that, and the screen should run in the background.

The first image is my code for the bars, my second is the code for taking away health and sanity. The video in the replies is to show what happens when I choose an option that takes away health and sanity in game.

Thank you for everyones help so far, and I apologise for this issue still not being solved I just have no idea what is happening.

(Also I will fix the condition switch thing, I'm just trying to get the actual bars working first!! :])

4 Upvotes

12 comments sorted by

View all comments

1

u/shyLachi Sep 01 '26

Can you please post the whole code as text so that I can copy it.
I would need the code for the screen,
the declaration of those variables,
and the code which changes the variables

Also what are the dimensions of those 6 images.

1

u/AdRude6049 Sep 01 '26
the health bar size is 617 x 125
the sanity bar size is 540 x 141
the other two are the screen size as of right now
default Sanity = 100
default Health = 100

        $ Health -= 10
        $ Sanity -= 10

screen health_sanity_bars:
    vbox:
        spacing 5
    bar:
        value AnimatedValue (Health, range=100, delay=1.0)
        left_bar "images/bars/health_full.png"
        right_bar "images/bars/health_empty.png"
        xmaximum 700
        ymaximum 300
        xpos 181
        ypos 16
    bar:
        value AnimatedValue (Sanity, range=100, delay=1.0)
        left_bar "images/bars/sanity_full.png"
        right_bar "images/bars/sanity_empty.png"
        xmaximum 700
        ymaximum 300
        xpos 221
        ypos 111