View Single Post
  #8  
Old 11-01-2012, 07:39 PM
ffcmike ffcmike is offline
Banned
Join Date: Jul 2004
Location: London
Posts: 2,029
ffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond reputeffcmike has a reputation beyond repute
Send a message via AIM to ffcmike Send a message via MSN to ffcmike
If you didn't find a Clientside solution yet and onWasHit is being invoked by all forms of damage, you could try:

PHP Code:
function onWasHit(){
  
//receive original x and y from before first frame of recoil movement
  
temp.x = player.x - player.hurtdx;
  
temp.y = player.y - player.hurtdy;
  
temp.plist = findnearestplayers(temp.x, temp.y);
  for(
temp.pl : temp.plist){
    if(
temp.pl.ani.name == "sword"){
      
temp.bx = temp.pl.x + 0.5 + (vecx(temp.pl.dir) * 2);
      
temp.by = temp.pl.y + 1 + (vecy(temp.pl.dir) * 2);
      if(
        
temp.x + 0.5 <= temp.bx + 2 &&
        
temp.x + 2.5 >= temp.bx &&
        
temp.y + 1 <= temp.by + 2 &&
        
temp.y + 3 >= temp.by
      
){
        
this.playerSlashed(temp.pl);
        return;
      }
    }
  }
} 
Reply With Quote