This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hey im trying to make a game where based on user input the game gives them a result of perfected, good or incorrect.

In this function I'm trying to change the color of the text based on what is in the text but i really don't know what I'm doing.

extends RichTextLabel

export (Color,RGB) var text_color

func ready():
set
modulate(text_color)
pass

func textcolorchanger():
if "Perfected" in text:
text
color = Color(0,255,0)
elif "Good" in text:
textcolor = Color(100,200,0)
elif "Incorrect" in text:
text
color = Color(200,0,0)
pass

func onLineEdittextentered(newtext):
_text
color_changer()

Also if you can i would also like to know how to make the text fade out couple seconds after it appears?

Thanks guys.

in Engine by (21 points)

1 Answer

0 votes
Best answer

You could directly apply it to your text via modulate or self_modulate = Color(0, 0, 0)

As for the animation you could use Animation Player
and key its modulate if you used self_modulate and vice versa

and adjust the line for time a little further by milliseconds and then
set a another key with lower opacity

and then call it in your code $AnimationPlayerPAth.play("Anim Name")

by (410 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.