How to animate the text to gradually change in colour?
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.
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.
How to animate the text to gradually change in colour?
Is there a way to make the text gradually change in colour? I want to use this to indicate character health in combat.
- xavimat
- Eileen-Class Veteran
- Posts: 1461
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Discord: xavimat
- Contact:
Re: How to animate the text to gradually change in colour?
You can't change gradually the color in front of the player, but you can have the color of the text checked every time that text is shown to the player.
I guess it's tricky.
Do you need the change on the normal text that the character says, or in a screen that you have made?
You need to go to the screen that have that text and "color" that text with some variable that you change somewhere, according the health.
A simply (and ugly) example:In the file "screens.rpy", look for the screen "say":
And change the linewith:
Every time the health changes, the color of the next text will tend to "red".
In this example, every character will be affected. You need an "if" statement inside the screen to avoid that.
I guess it's tricky.
Do you need the change on the normal text that the character says, or in a screen that you have made?
You need to go to the screen that have that text and "color" that text with some variable that you change somewhere, according the health.
A simply (and ugly) example:
Code: Select all
default health = 255
label start:
"Hello, world."
$ health -= 60
e "You've created a new Ren'Py game."
$ health -= 60
e "Once you add a story, pictures, and music, you can release it to the world!"
return
Code: Select all
screen say(who, what):
Code: Select all
text what id "what"
Code: Select all
text what id "what" color (255, health, health)
In this example, every character will be affected. You need an "if" statement inside the screen to avoid that.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
- 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: How to animate the text to gradually change in colour?
The Ren'py Color object supports a lot of colour mangling options
Example with interpolate...
Example with interpolate...
Code: Select all
default colour_base = "#FF0000"
default colour_top = "#00FF00"
default colour_refs = [0.0, 0.01]
screen colour_test():
python:
colour_refs[1] = colour_refs[1] if 0.0 <= colour_refs[0] <= 1.0 else 0 - colour_refs[1]
colour_refs[0] += colour_refs[1]
ref_colour = Color( colour_base )
#
# this basically takes our ref_colour object ( with colour_base ) and pushes
# it toward the colour_top using a floating point fraction (0.0 to 1.0) to
# determine the final used colour
#
used_colour = ref_colour.interpolate( colour_top, colour_refs[0] )
text "{0}%".format(round(colour_refs[0]*100)) color used_colour
timer 0.1 action (renpy.restart_interaction) repeat True
label start:
show screen colour_test
"First Line"
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Re: How to animate the text to gradually change in colour?
I'm trying to change the colour of the name of the character.
Who is online
Users browsing this forum: Bing [Bot]