Suppose I want RGB values as follow for
1st second [ 0, 0 , 0 ]
2nd second [ 0. 2 , 0 , 0 ]
3rd second [ 0.4 , 0 , 0 ]
4th second [ 0.6 , 0, 0 ]
5th second [ 0.8 , 0 , 0 ]
6th second [ 1 , 0 , 0 ]
Since Python FOR LOOP doesn’t support floating point numbers, I used while loop as follow,
from bge import logic
import timecont=logic.getCurrentController()
own=cont.owneri=0;
while(i<=1):
own.meshes[0].materials[0].diffuseColor=i,0,0
i=i+0.2
time.sleep(1)
This is not working, hence I written same code without using loop
from bge import logic
import timecont=logic.getCurrentController()
own=cont.ownerown.meshes[0].materials[0].diffuseColor=0,0,0
time.sleep(1)own.meshes[0].materials[0].diffuseColor=0.2,0,0
time.sleep(1)own.meshes[0].materials[0].diffuseColor=0.4,0,0
time.sleep(1)own.meshes[0].materials[0].diffuseColor=0.6,0,0
time.sleep(1)own.meshes[0].materials[0].diffuseColor=0.8,0,0
time.sleep(1)own.meshes[0].materials[0].diffuseColor=1,0,0
time.sleep(1)
but still it’s not working.