Change colour using distance.
in
Programming Questions
•
10 months ago
I am having trouble getting a shape to change colour as it falls to the bottom of the screen. At the moment, using the code below my shape doesn't change colour until it is at the bottom of the screen, whereupon it changes and then changes back instantly. Could someone please tell me why my code does this? I need the shape to gradually change from yellow to red.
g = 255 - dropRate; // g is the green component
y = y + 1; // y is the y pos of the shape
distance = height - y;
dropRate = 255/distance;
1