Always-visible bars?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
teeth
Newbie
Posts: 7
Joined: Thu Jan 26, 2017 1:36 pm
Contact:

Always-visible bars?

#1 Post by teeth » Mon Feb 13, 2017 8:51 pm

I'm messing around with a simulation project that's designed to have an always-visible sidebar that displays the player's stats. So far I have something like this:

Code: Select all

screen sidebar:
    zorder 1
    frame:
        background "sidebar.png"
        left_margin  20
        bottom_margin 5
        left_padding  15
        #top_margin  40
        xalign 0.0
        yalign 0.0
        vbox:
            label "[weekday], [month] [day]"
            label "Energy: [energy]/100"
I'm not trying to make it pretty quite yet, I'm just trying to make it display what I want it to display. So far, it seems to work well enough.

However, instead of just having it display how many energy points the player currently has, I'd like to display a bar. I've tried the bar tutorials listed on the forums, but I haven't been able to figure out how to do this without my game crashing because I did something incompatible. I'm very new to coding, so if someone could show me what to do or explain this in a very simple way, I'd be incredibly grateful?

User avatar
wyverngem
Miko-Class Veteran
Posts: 615
Joined: Mon Oct 03, 2011 7:27 pm
Completed: Simple as Snow, Lady Luck's Due,
Projects: Aether Skies, Of the Waterfall
Tumblr: casting-dreams
itch: castingdreams
Location: USA
Contact:

Re: Always-visible bars?

#2 Post by wyverngem » Tue Feb 14, 2017 12:54 am

You need to create two init variables. Something like current_energy and max_energy.

Then add a bar to your screen.

Code: Select all

bar value current_energy range max_energy
https://www.renpy.org/doc/html/screens.html#bar

philat
Eileen-Class Veteran
Posts: 1853
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Always-visible bars?

#3 Post by philat » Tue Feb 14, 2017 4:43 am

You can also just do plain

Code: Select all

bar value energy range 100

Post Reply

Who is online

Users browsing this forum: No registered users