EDIT: Scratch that didn't need to use it.
Ran into another problem. It works great, but its pretty much doing the opposite. I've messed with the math in
temp.done but its still not right. The closer I am to the player, the lower the alpha. Which is the opposite and I'm not sure how I can flip it? Also I think the distance needs to be converted to less than 1 (decimals under 1) but i'm stumped!
PHP Code:
//#CLIENTSIDE
function onCreated() {
setTimer(0.05);
}
function onTimeout() {
for (temp.pl: allplayers) {
if (pl.level.name == null) continue;
//define distance formula
temp.a = (pl.x - player.x) ^ 2;
temp.b = (pl.y - player.y) ^ 2;
temp.c = (temp.a + temp.b) ^ 0.5;
temp.done = temp.c;
player.chat = temp.done;
temp.pl.alpha = temp.done;
}
setTimer(0.05);
}
Sorry!
There's got to be an easier way of doing this:
PHP Code:
//#CLIENTSIDE
function onCreated() {
setTimer(0.05);
player.alpha = 1;
}
function onTimeout() {
for (temp.pl: allplayers) {
if (pl.level.name == null) continue;
//define distance formula
temp.a = (pl.x - player.x) ^ 2;
temp.b = (pl.y - player.y) ^ 2;
temp.c = (temp.a + temp.b) ^ 0.5;
temp.done = temp.c;
//player.chat = temp.done;
if (temp.c < 5) {
pl.alpha = 1;
}
if (temp.c > 5 && temp.c <= 10) {
pl.alpha = 0.75;
}
if (temp.c > 10 && temp.c <= 15) {
pl.alpha = 0.5;
}
if (temp.c > 15 && temp.c <= 20) {
pl.alpha = 0.25;
}
if (temp.c > 20) {
pl.alpha = 0;
}
}
setTimer(0.05);
}