I'm not sure it will work.
In your code
PHP Code:
if(Alpha[entity] >= 255) Alpha[entity] = 255;
else Alpha[entity] = 0;
has an logic error(if your purpose is what I guess...). It will make alpha array always be 0 or 255. And if you didn't give the initial value as 255, it will always be 0.
So the value you input to entity will always be (255 - 0).