0 votes

Hello,

I drew a custom polygon2D and set a color but i'm not able to change the alpha in the color class by code to a scalable value.
Indeed it's either 0 or 1 when i'm using setColor(Color(0,255,0,128)).
Using the editor seems to work better but i need to draw perfect rectangle with custom alpha and color.
Maybe i can use another way to define my polygon color ?

asked Oct 31, 2016 in Engine by dabrain34 (21 points)

2 Answers

+1 vote
Best answer

Color values are normalized, with Color(0,255,0,128) you are saying Color(0.0,1.0,0.0,1.0), for 50% alpha use 0.5.
https://godot.readthedocs.io/en/stable/classes/class_color.html

answered Nov 1, 2016 by eons (7,786 points)
selected Nov 1, 2016 by dabrain34
0 votes

Here is a usefull converter from RGB Hex to RGB normalized decimal.

http://doc.instantreality.org/tools/color_calculator/

answered Nov 21, 2016 by dabrain34 (21 points)
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.