changing color within the game

How would one cause an object to change it’s color while within a game? (specifically, according to it’s distance from another object - i currently have logic blocks set up to emit sounds acording to the distance, but i havent been able to find a way to cause the color of the object to change)

Also, is there a simple wayy of interfacing blender and other existing programs (some kind of global variable that blender can set and the other program read? currently i am just writing to a file and having the other program read it, but this is kinda combersome…)

thanks in advance,
Sh
(it’s great ot be back to blender - used it for some science projects a few years ago, and now finally have a good excuse to use it again in the lab! :slight_smile: )

Well, in Blender 2.5, KX_GameObject has a color attribute:


myob.color = [1, 0, 0, 1] # Make the object red

The material has to be set to object color for that work though.

Another option is to setup a a color ipo/fcurve to that uses frames 0 to 100. Then, you can just use the property option on the ipo/fcurve actuator.