Thread: Some angle help
View Single Post
  #12  
Old 10-31-2007, 01:17 AM
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
Alright, thanks, but I think there's something wrong with my onwall checks...
PHP Code:
function onCreated() {
  
this.anglex = this.angley = NULL;
  
this.moving = this.canhurt = false;
  
this.velocity = this.dist = this.momentum = NULL;
  
this.distgone = this.time = this.timetotal = NULL;
}
function 
onActionHit(damage, accuracy, effects, acc, px, py) {
  
temp.px = px+1.5; temp.py = py+2;
  
this.distgone = 0;
  
this.anglex = getangle(temp.px-this.x,temp.py-this.y);
  if (
this.anglex > degtorad(180))
    
this.anglex -= degtorad(180);
  else 
this.anglex += degtorad(180);
  
this.angley = this.anglex;
  
this.velocity = ((damage*4.45)/this.weight)*.05;
  
temp.momentum = this.weight * this.veolocity;
  if (
temp.momentum > 5) this.canhurt = true;
  else 
this.canhurt = false;
  
temp.friction = this.weight/damage;
  if (
temp.friction>=1) this.dist = 0;
  else 
this.dist = .75 / temp.friction;
  
this.moving = true;
  
onTimeOut();
}
function 
onTimeOut() {
  if (
this.moving) {
    if (
this.distgone<this.dist) {
      
temp.dx = this.x+(this.velocity*cos(this.anglex));
      
temp.dy = this.y+(this.velocity*(-sin(this.angley)));
      if (!
onwall(temp.dx,temp.dy)) {
        
this.x = temp.dx; this.y = temp.dy;
        
this.distgone += this.velocity;
      }
      else {
        
temp.bx = onwall(temp.dx,this.y);
        
temp.by = onwall(this.x,temp.dy);
        if (
temp.bx && temp.by) {
          
this.anglex = pi - this.anglex;
          
this.angley = this.anglex;
        }
        else {
          if (
temp.bx) this.anglex = pi - this.anglex;
          if (
temp.by) this.angley = pi - this.angley;
        }
        
//this.velocity = this.velocity/2;
        
this.dist = this.dist-this.distgone;
        
this.distgone = 0;
      }
      
setTimer(0.05);
    }
  }
} 
They're pretty off...
__________________

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