Color of bar value AnimatedValue

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
User avatar
Mirrodin
Regular
Posts: 114
Joined: Sun Mar 19, 2017 2:56 pm
Contact:

Color of bar value AnimatedValue

#1 Post by Mirrodin »

Hi,

I search on the doc but there are no example of colored (no image) bar animated value.
I have this overlay,
I want life in red and mana in blue, i cant add the color argument... How can i do this simply ?

Code: Select all

screen gold_overlay():
    # Add real displayables showing your gold
     #add Solid("#f0999f", xsize=1200, ysize=50, xalign=0.5)
     add "interface.png" align (0.5, 0) 
     add "credit.png" zoom 0.3 align (0.13, 0.02)
     text '{color=#000000}[inventaire_joueur.credit]{/color}' align (0.18, 0.03) 
     hbox:
         xsize 120+joueur.pm_max/4 ysize 30
         
         add "mana.png" zoom 0.15
         bar value AnimatedValue(joueur.pm_actu, range=joueur.pm_max) ysize 15 
         align (0.25, 0.045)
     hbox:
         xsize 120+joueur.pv_max/4 ysize 30
         add "hp.png" zoom 0.15
         bar value AnimatedValue(joueur.pv_actu, range=joueur.pv_max) ysize 15
         align (0.25, 0.022)         
     text '[joueur.pm_actu]/[joueur.pm_max]' align (0.28, 0.045) size 14
     text '[joueur.pv_actu]/[joueur.pv_max]' align (0.28, 0.022) size 14
     textbutton "Inventaire" style "lilbutton" text_style "lilbutton_text" action Jump("inventaire") align (0.53, 0.03)
     zorder 100

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

Re: Color of bar value AnimatedValue

#2 Post by philat »

Ren'py does not "color" bars without images. All bars are images. The default theme bars are also images, just colored using Ren'py's internal processes. AnimatedValue is just a value for a bar -- it uses the same bar styles so chance the bar style and the AnimatedValue will just animate whatever that style is. Therefore, probably the simplest solution is simply to create your own bar images in the colors that you want and apply them to your bars.

That said, you can also mimic the Ren'py theme styler and tint a greyscale bar if you prefer -- this will also entail choosing that greyscale bar image, however. This is old code from the legacy gui, and I haven't poked around the new gui to see what the default bar images are, but hopefully it will give you enough hints to get you going. viewtopic.php?f=8&t=33915#p385437

User avatar
Mirrodin
Regular
Posts: 114
Joined: Sun Mar 19, 2017 2:56 pm
Contact:

Re: Color of bar value AnimatedValue

#3 Post by Mirrodin »

Thanks for ure answer :)
I will try that.

Post Reply

Who is online

Users browsing this forum: Andredron, geoWaffle, Google [Bot]