Advertisement
Lucassim

Untitled

Jul 28th, 2013
306
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. bool sonAdyacentes(Personaje* p, Enemigo* e){
  2.  
  3.     if (p->x >= MAP_SIZE)
  4.         return false;
  5.     if ( p->x == e -> x){
  6.         if (p->y == e->y+1)
  7.             return true;
  8.         if (p->y == e->y-1)
  9.             return true;
  10.     }
  11.  
  12.     if ( p->y == e -> y){
  13.         if (p->x == e->x+1)
  14.             return true;
  15.         if (p->x == e->x-1)
  16.             return true;
  17.     }
  18.    
  19.     //diag izq
  20.     if ( p->x == e -> x+1){
  21.         if (p->y == e->y+1)
  22.             return true;
  23.         if (p->y == e->y-1)
  24.             return true;
  25.     }
  26.     //diag der
  27.     if ( p->x == e -> x-1){
  28.         if (p->y == e->y+1)
  29.             return true;
  30.         if (p->y == e->y-1)
  31.             return true;
  32.     }
  33.  
  34.     return false;
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement