[USABLE CODE] Power/energy meter

A place for Ren'Py tutorials and reusable Ren'Py code.
Forum rules
Do not post questions here!

This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Post Reply
Message
Author
TorroesPrime
Newbie
Posts: 14
Joined: Fri Mar 30, 2018 6:12 pm
Contact:

[USABLE CODE] Power/energy meter

#1 Post by TorroesPrime »

So I wanted to have a bar meter on the left side of the screen that could be dynamically changed through my game.

Here is what I came up with:
Image

Code: Select all

screen powerMeter(oldValue, newValue, name):
    add Transform(Solid("#00086b"), size=(75,400))
    hbox:
        text name at vert_text
        
    bar value AnimatedValue(value=newValue, old_value=oldValue, delay=1.0, range=120):
        #value scanPower
        bar_vertical True
        range 120
        bottom_bar "idle_bar.png"
        top_bar "bar_empty.png"
        xysize(15, 360)
        xalign .0015
        yalign 0
        xoffset 25
        at transform:
            yoffset 25
            xoffset 20
the values are pretty straight forward I think:
oldValue = the value the bar will display at the time the screen is called.
newValue = the value the bar will display after the animation is over.
name = the text that is displayed on the screen.

Post Reply

Who is online

Users browsing this forum: No registered users