Sample Use this class:
Define a new colour color, such as "private color red = new Color (198, 58, 41);" "Add the variable name variable name to the colors array of the color, and use the ChangeColor method to loop the color."
Modify the following settings
Import com.cult3d.*; Import com.cult3d.world.*; Import Java.awt.Color; Import Java.awt.Image; Import Java.awt.Graphics; public class Colorswap implements Cult3dscript, Runnable {//Texture_name value is the name of the texture you want to change. private static final String textu Re_name = "Madarose"; If you are want to add colors add a Color instance here//and add it to the colors array. The numbers are in RGB values (0 to 255, where 0 are black and 255 are white) private Color red = new Color (198, 58, 41); Private color blue = new color (99, 93, 163); Private color green = new color (138, 149, 78); Private color grey = new color (136, 136, 136); Private color LightBlue = new Color (121, 130, 173); Private color black = new Color (64, 64, 64); Private color[] colors = {Red, blue, green, grey, LightBlue, black}; private texture texture; Private Textureimage textureimage; private int texturewidth, textureheight; Private Graphics Graphics; Declare This is variable volatile, so it always keeps the right value private volatile boolean loaded = false; private int colorcounter = 0; Standard Constructor Public Colorswap () {Thread thread = new thread (this); Thread.Start ();}//Thread method which lo Ads "heavy" resources/textures//To avoid the viewer hang when loading. public void Run () {texture = new texture (texture_name); texturewidth = Texture.getwidth (); textureheight = Texture.gethei Ght (); Textureimage = (textureimage) cult.createimage (Texturewidth, textureheight); Graphics = Textureimage.getgraphics (); loaded = true; }/* Note:lines started with two slashes (//) is line comments and isn't in the final class file, Lines with Slash-star is another comment which is called ' block comment ' which comments a block of code until it encounters Star-slash. As *//Use this method from the Designer to loop the colors. public void ChangeColor (String s) {if (!loaded) {System.out.println ("The Java code isn't yet loaded");if (Colorcounter >= colors.length) {colorcounter = 0;} switchcolor (Colors[colorcounter)); colorcounter++; }//The actual color change private void Switchcolor (color color) {graphics.setcolor (color); Graphics.fillrect (0,0, text Urewidth,textureheight); Texture.settexture (Textureimage); public void Cult3ddestroy () {}}