Posted By: TheStonerunner
Visual pop when walls fade out - 09/14/07 09:32
I'm using a modified version of the smart_walls action. The roof that I'm fading in and out has several pieces, but all are combined on one mesh. When the walls start to go invisible, one piece stays fully visible until everything else is almost as transparent as it will get, and vice versa on reappearing. The code is as follows:
action smart_walls
{
while (1)
{
if (vec_dist (my.x, camera.x) < 220) // play with this value
{
if (my.TRANSLUCENT == OFF)
{
my.TRANSLUCENT = ON;
my.alpha = 100;
while (my.alpha > 20)
{
my.alpha -= 10 * time;
wait(1);
}
}
}
else
{
if (my.TRANSLUCENT == ON)
{
while (my.alpha < 100)
{
my.alpha += 10 * time;
wait(1);
}
my.TRANSLUCENT = OFF;
}
}
wait (1);
}
}
action smart_walls
{
while (1)
{
if (vec_dist (my.x, camera.x) < 220) // play with this value
{
if (my.TRANSLUCENT == OFF)
{
my.TRANSLUCENT = ON;
my.alpha = 100;
while (my.alpha > 20)
{
my.alpha -= 10 * time;
wait(1);
}
}
}
else
{
if (my.TRANSLUCENT == ON)
{
while (my.alpha < 100)
{
my.alpha += 10 * time;
wait(1);
}
my.TRANSLUCENT = OFF;
}
}
wait (1);
}
}