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():

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

func onLineEdittextentered(newtext):

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

Thanks guys.

asked Jun 20 in Engine by retsi3602 (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")

answered Jun 20 by LoneDespair (315 points)
selected Jun 21 by retsi3602
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 How to use this Q&A? before posting your first questions.