I am making a pseudo-3D game with a level that involves the character standing on a conveyor belt heading into a darkened tunnel and am having trouble with programming the RGB values of objects emerging from the darkness in the distance.
I have programmed a formula to alter the RGB Coefficient value dependant on the Y-value of the desired object so that it becomes less dark as it appears to approach the camera.
This, in theory works when the calculated value is between 0 and 255.
HOWEVER, when the value is calculated at LESS than 0, the object is then displayed at what I describe as "255" value.
The inverse also happens once an object appears close to the maximum Y-value, and if the RGB value is more than 255, the object then goes black, as if at "0" value.
How can I effectively limit the max/min range of this value so that I can avoid this problem?
I have tried setting up a range condition in the same event, but it doesn't appear to do the job.