0 votes


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 ?

in Engine by (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.

by (7,812 points)
selected by
0 votes

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


by (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.
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 webmaster@godotengine.org with your username.