(Sorry for double posting)
I changed it to this:
PHP Code:
function onTimeOut() {
if (this.distgone < this.dist) {
temp.x = this.x+1; temp.y = this.y+1;
if (!onwall(temp.x+cos(this.angle)*this.velocity, temp.y))
this.x += cos(this.angle)*this.velocity;
else
this.angle = pi - this.angle;
if (!onwall(temp.x,temp.y+(-sin(this.angle))*this.velocity))
this.y += -sin(this.angle)*this.velocity;
else
this.angle = -this.angle;
this.distgone += this.velocity;
this.velocity = (this.velocity/7)*6;
setTimer(0.05);
}
}
But the onwall checks are still off o.o