Thread: Some angle help
View Single Post
  #18  
Old 11-03-2007, 07:55 PM
coreys coreys is offline
N-Pulse Assistant Manager
coreys's Avatar
Join Date: Mar 2005
Posts: 2,180
coreys has a spectacular aura about
Send a message via AIM to coreys Send a message via MSN to coreys Send a message via Yahoo to coreys
I've tried everything I could think of, and I still can't get the onwall checks to be correct:
PHP Code:
function onTimeOut() {
  if (
this.distgone this.dist) {
    
temp.this.x+1temp.this.x+1;
    
temp.dx temp.x+(this.velocity*cos(this.anglex));
    
temp.dy temp.y+(this.velocity*(-sin(this.angley)));
    
temp.dir getdir(temp.dx-temp.xtemp.dy-temp.y);
    if (!
onwall(temp.dx,temp.dy)) {
      
this.+= this.velocity*cos(this.anglex);
      
this.+= this.velocity*(-sin(this.angley));
      
this.distgone += this.velocity;
      
this.velocity = (this.velocity/5)*4;
    }
    else {
      
temp.bx onwall(temp.dx,temp.y);
      
temp.by onwall(temp.x,temp.dy);
      if (
temp.bx && temp.by) {
        
this.anglex pi this.anglex;
        
this.angley this.anglex;
      }
      else {
        if (
temp.bxthis.anglex pi this.anglex;
        if (
temp.bythis.angley pi this.angley;
      }
      
temp.dx this.x+1+(this.velocity*cos(this.anglex));
      
temp.dy this.y+1+(this.velocity*(-sin(this.angley)));
      if (!
onwall(temp.dx,temp.dy)) {
        
this.temp.dx-1;
        
this.temp.dy-1;
        
this.distgone += this.velocity;
      }
      
this.velocity = (this.velocity/5)*3;
    }
    if (
this.velocity <= .005this.dist this.distgone 0;
    else 
setTimer(0.05);
  }

I only have the angles split into x and y because of checking if it's hitting a wall vertically or horizontally. That's the only way I could think of doing it.

This is really starting to frustrate me.
__________________

Quote:
*SlikRick: so should I even ask about your aim status?
*Xor: well if you want to
*Xor: but i am LARPING
*SlikRick: While on a computer?
*Xor: yes
*Xor: in my living room
*SlikRick: ahh
*Xor: i have a fort setup to hide from beasts
Reply With Quote