AUM 34 and 36 has something similar to this(updated 36 version is below). It's a sun flare/glare script. When you look towards the sun entity, the panel's alpha increases and vice versa:
Code:
var angles_to_sun[3];
bmap flarepan_tga = <flarepan.tga>;
entity* aum_sun;
panel flare_pan
{
pos_x = 0;
pos_y = 0;
bmap = flarepan_tga;
flags = overlay, refresh, transparent, visible;
}
action my_own_sun
{
// my.invisible = on; // remove the comment if you want to hide the sun model
my.passable = on;
aum_sun = my;
}
starter get_sun_angles()
{
while (aum_sun == null) {wait (1);}
while (player == null) {wait (1);}
vec_set (temp.x, aum_sun.x);
vec_sub (temp.x, player.x);
vec_to_angle (angles_to_sun, temp); // got the (pan, tilt) angles from the initial position of the player to the sun
while (1)
{
camera.pan %= 360;
temp.x = 0.2 * abs(camera.pan - angles_to_sun[0]); // play with 0.2
temp.y = 0.2 * abs(camera.tilt - angles_to_sun[1]); // play with 0.2
flare_pan.alpha = 100 / ((temp.x + 1) * (temp.y + 1));
wait (1);
}
}