0

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?

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Roger Oba
  • 1,292
  • 14
  • 28

2 Answers2

1

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));
Jason
  • 1,658
  • 3
  • 20
  • 51
rafalopez79
  • 2,046
  • 4
  • 27
  • 23
  • The code works, but I guess robocode doesn't support transparency, which was what I was trying to achieve... Thank you anyways, it was useful! – Roger Oba Sep 26 '14 at 12:51
0

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));
Jason
  • 1,658
  • 3
  • 20
  • 51
Ahmed Nassar
  • 93
  • 1
  • 2
  • 5