bar customization

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
OrsonDeWitt
Regular
Posts: 35
Joined: Thu Dec 06, 2018 3:23 am
Contact:

bar customization

#1 Post by OrsonDeWitt » Wed Jun 24, 2020 12:45 pm

Hello there!
Was just wondering if it was possible to make a bar fill in not with one color, but basically color the image with its original colors. Say, if the left image was black-and-white, and the right image was colored; how would you go about making it so that as the bar gets updated with higher values, the image is colored accordingly?

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: bar customization

#2 Post by Remix » Wed Jun 24, 2020 7:49 pm

Did you want that bar to dynamically change colour as the value changed?

You could set the left/right_bar displayable to be a dynamic displayable that returned a Solid or somesuch that changed colour based on the variable.

Not fully sure what you want though... A bar naturally shows X% of the left_bar image, 100-X% of the right_bar image with optional thumb etc... Those can be coloured as you want.
Frameworks & Scriptlets:

User avatar
namastaii
Eileen-Class Veteran
Posts: 1350
Joined: Mon Feb 02, 2015 8:35 pm
Projects: Template Maker for Ren'Py, What Life
Github: lunalucid
Skype: Discord: lunalucid#1991
Soundcloud: LunaLucidMusic
itch: lunalucid
Location: USA
Contact:

Re: bar customization

#3 Post by namastaii » Thu Jun 25, 2020 1:04 pm

If these images are already saved in those colors, you'd assign the left bar to the right image and the right bar to the right image and it should do exactly what you described. https://www.renpy.org/doc/html/style_pr ... properties
You could probably benefit from reading about styles as well if you haven't already
https://www.renpy.org/doc/html/style.ht ... -statement

Here is someone's tutorial on bar customization viewtopic.php?t=27332 (I don't believe they're using styles, but you'll see the general way to do things with bars)

OrsonDeWitt
Regular
Posts: 35
Joined: Thu Dec 06, 2018 3:23 am
Contact:

Re: bar customization

#4 Post by OrsonDeWitt » Fri Jun 26, 2020 3:38 pm

Oh, wow. I didn't expect for it to work like this right off the bat. Renpy rules.
Thanks.

Post Reply

Who is online

Users browsing this forum: Google [Bot]