Guest User

Untitled

a guest
Sep 21st, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.06 KB | None | 0 0
  1.     // Get an array containing all active Players in the game
  2.     std::map<int, Entity*> temp;
  3.     dynamic_cast<MainGame*>(_state)->getGameObjectManager().getGroup(Entity::entityName::entityPlayer, temp);
  4.  
  5.     //Check to see if any of these bullets are colliding with the enemy object.
  6.     std::map<int, Entity*>::const_iterator itrr = temp.begin();
  7.     while(itrr != temp.end())
  8.     {
  9.         if(GetBoundingRect().intersects(itrr->second->GetBoundingRect()))
  10.         {
  11.             toggleDeath();
  12.         }
  13.         itrr++;
  14.     }
  15.  
  16.     // Get an array containing all active bullets in the game
  17.     std::map<int, Entity*> tempArray;
  18.     dynamic_cast<MainGame*>(_state)->getGameObjectManager().getGroup(Entity::entityName::entityBullet, tempArray);
  19.  
  20.     //Check to see if any of these bullets are colliding with the enemy object.
  21.     std::map<int, Entity*>::const_iterator itr = tempArray.begin();
  22.     while(itr != tempArray.end())
  23.     {
  24.         if(itr->second->GetBoundingRect().intersects(GetBoundingRect()))
  25.         {
  26.             toggleDeath();
  27.             itr->second->alive = false;
  28.             _Player->addScore(pointValue);
  29.             _Player->addXP(pointValue);
  30.         }
  31.         itr++;
  32.     }
Add Comment
Please, Sign In to add comment