Search code examples
javacolorsrobocode

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.

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?


Solution

  • 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));