Pastebin launched a little side project called VERYVIRAL.com, check it out ;-) Want more features on Pastebin? Sign Up, it's FREE!
Guest

lolololol

By: a guest on Nov 7th, 2012  |  syntax: C++  |  size: 1.01 KB  |  views: 45  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. int actCollision( SDL_Rect offender, SDL_Rect defender, int offenderType, int defenderType )
  2. {
  3.  
  4.     //if the one moving into the space is a zombie
  5.     if ( offender.y == defender.y && offender.x == defender.x && offenderType == 3 && defenderType == 2 )
  6.     {
  7.         defenderType = 3;// the one occupying the space is now a zombie
  8.         return (defenderType);
  9.     }
  10.     // if player
  11.     else if ( offender.y == defender.y && offender.x == defender.x && offenderType == 3 && defenderType == 1 )
  12.     {
  13.         stop(); // game over
  14.     }
  15.  
  16. }
  17.  
  18. int checkCollision()
  19. {
  20.     int compare1 = 1;
  21.     int compare2 = 1;
  22.    
  23.     while( compare1 < 49 )
  24.     {
  25.         if( compare2 == 49 )
  26.         {
  27.             compare1 ++;
  28.         }
  29.         else
  30.         {
  31.         if( compare1 != compare2 )
  32.         {
  33.             actCollision( object[compare1], object[compare2], type[compare1], type[compare2] );
  34.             compare2 ++;
  35.         }
  36.         else
  37.         {
  38.             compare2 ++;
  39.         }
  40.         }
  41.     }
  42.  
  43. }