This doesnt seem to be choosing the random correctly..
PHP Code:
//#CLIENTSIDE
public function DrawLine( ind, sx, sy, tx, ty, wid, r, g, b, alph ) {
temp.ang = getangle(tx - sx, ty - sy) + (pi/2);
temp.wid = ( wid == NULL ? .1 : wid );
with ( findImg(ind) ) {
polygon = {
sx, sy,
tx, ty,
tx + cos(ang)*wid, ty - sin(ang)*wid,
sx + cos(ang)*wid, sy - sin(ang)*wid
};
red = ( r < 0 || r > 1 ? 0 : r );
green = ( g < 0 || g > 1 ? 0 : g );
blue = ( b < 0 || b > 1 ? 0 : b );
alpha = ( alph <= 0 || alph > 1 ? 1 : alph);
layer = 3;
}
}
function onMouseDown() {
this.angle = random(this.angle-15,this.angle+15); // angle
this.distance = random(5,7); // distance
this.nx = x + sin(this.angle) * this.distance;
this.ny = y + cos(this.angle) * this.distance;
DrawLine(2000, this.nx, this.ny, x, y);
}
The angles are still wrong.. it's supose to pick a random angle within 15 degrees of current angle.. o_O but it's still 360 =/