maxdist = 500; // This Variable tells the distance at which the Gradient will be fully invisible. If the Player is any farther than this, it will also be invisible.
obj_gradient1.image_alpha = (maxdist-distance_to_object(obj_player))/maxdist;
That will make sure it is not set to more than one.
Also, when you say it "doesn't work", do you mean the Gradient stays invisible, or fully visible?
BTW, if you take a class like Physics or Chemistry, this is a simple modification of the Percent Error Formula.
This post has been edited by OniLink10 on Oct 6 2009, 09:49 PM