I built a robot in Robocode and I want it to have custom colors, more specifically using RGBA.
Is that possible?
I tried:
setBodyColor(Color.fromArgb(150, 0, 150));
setBodyColor(Color(0.0f,0.0f,0.0f,0.0f));
But neither worked. Any suggestions?
If you are programming with java:
Check this page in the API doc: http://docs.oracle.com/javase/6/docs/api/java/awt/Color.html#Color(int , int, int, int)
Try something like this (change the values):
int r = 25;
int g = 25;
int r = 25;
int a = 100;
robot.setBodyColor(new java.awt.Color(r,g,b,a));
This worked for me:
Add method:
private Color Color(int r, int g, int b, int a) {
return new Color(r, g, b, a);
}
And then call it:
setBodyColor(Color(0.0f, 0.0f, 0.0f, 0.0f));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.