Advertisement
ZoriaRPG

OnScreenEdge()

Sep 12th, 2017
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.46 KB | None | 0 0
  1.    
  2. //Returns true of an object is touching a screen edge.
  3. //Specify the size of the object in pixels, or pass HitWidth, HitHeight; or EffectWidth, EffectHeight.
  4. bool OnScreenEdge(lweapon l, int width, int height){
  5.     if ( l->X <= SCREEN_LEFT ) return true;
  6.     if ( ( l->X + width ) >= SCREEN_RIGHT ) return true;
  7.     if ( l->Y <= SCREEN_TOP ) return true;
  8.     if ( ( l->Y + height ) >= SCREEN_BOTTOM ) return true;
  9.     return false;
  10. }
  11.  
  12. bool OnScreenEdge(eweapon l, int width, int height){
  13.     if ( l->X <= SCREEN_LEFT ) return true;
  14.     if ( ( l->X + width ) >= SCREEN_RIGHT ) return true;
  15.     if ( l->Y <= SCREEN_TOP ) return true;
  16.     if ( ( l->Y + height ) >= SCREEN_BOTTOM ) return true;
  17.     return false;
  18. }
  19.  
  20. bool OnScreenEdge(npc l, int width, int height){
  21.     if ( l->X <= SCREEN_LEFT ) return true;
  22.     if ( ( l->X + width ) >= SCREEN_RIGHT ) return true;
  23.     if ( l->Y <= SCREEN_TOP ) return true;
  24.     if ( ( l->Y + height ) >= SCREEN_BOTTOM ) return true;
  25.     return false;
  26. }
  27.  
  28. bool OnScreenEdge(item l, int width, int height){
  29.     if ( l->X <= SCREEN_LEFT ) return true;
  30.     if ( ( l->X + width ) >= SCREEN_RIGHT ) return true;
  31.     if ( l->Y <= SCREEN_TOP ) return true;
  32.     if ( ( l->Y + height ) >= SCREEN_BOTTOM ) return true;
  33.     return false;
  34. }
  35.  
  36. bool OnScreenEdge(ffc l, int width, int height){
  37.     if ( l->X <= SCREEN_LEFT ) return true;
  38.     if ( ( l->X + width ) >= SCREEN_RIGHT ) return true;
  39.     if ( l->Y <= SCREEN_TOP ) return true;
  40.     if ( ( l->Y + height ) >= SCREEN_BOTTOM ) return true;
  41.     return false;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement