[英]How can I set alpha color on Robocode?
I built a robot in Robocode and I want it to have custom colors, more specifically using RGBA. 我在Robocode中构建了一个机器人,我希望它具有自定义颜色,尤其是使用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: 如果您使用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) 在API文档中检查此页面: 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));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.