Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Get an array containing all active Players in the game
- std::map<int, Entity*> temp;
- dynamic_cast<MainGame*>(_state)->getGameObjectManager().getGroup(Entity::entityName::entityPlayer, temp);
- //Check to see if any of these bullets are colliding with the enemy object.
- std::map<int, Entity*>::const_iterator itrr = temp.begin();
- while(itrr != temp.end())
- {
- if(GetBoundingRect().intersects(itrr->second->GetBoundingRect()))
- {
- toggleDeath();
- }
- itrr++;
- }
- // Get an array containing all active bullets in the game
- std::map<int, Entity*> tempArray;
- dynamic_cast<MainGame*>(_state)->getGameObjectManager().getGroup(Entity::entityName::entityBullet, tempArray);
- //Check to see if any of these bullets are colliding with the enemy object.
- std::map<int, Entity*>::const_iterator itr = tempArray.begin();
- while(itr != tempArray.end())
- {
- if(itr->second->GetBoundingRect().intersects(GetBoundingRect()))
- {
- toggleDeath();
- itr->second->alive = false;
- _Player->addScore(pointValue);
- _Player->addXP(pointValue);
- }
- itr++;
- }
Add Comment
Please, Sign In to add comment