Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unsigned Game::mobsWithin(unsigned squares)
- {
- if (mobs.size() == 0)return 0;
- unsigned count = 0;
- for (auto i = mobs.begin(); i != mobs.end(); ++i)
- {
- int disX = abs(int((int)player.getLoc().getX() - i->getLoc().getX()));
- int disY = abs(int((int)player.getLoc().getY() - i->getLoc().getY()));
- if (disX <= squares && disY <= squares)
- {
- ++count;
- }
- }
- return count;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement