Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // -- EVASION -- //
- for (int i=0; i<map->crowd.size(); i++) {
- if (this!=map->crowd[i] && map->crowd[i]->visible) {
- float x = (getPosition()+time*velocity - map->crowd[i]->getPosition()).x;
- float y = (getPosition()+time*velocity - map->crowd[i]->getPosition()).y;
- if (x*x+y*y <= (radius + map->crowd[i]->radius)*(radius + map->crowd[i]->radius)) {
- moveLeft(time*10);
- break;
- }
- }
- }
- setVelocity(normalize(nextNode->getPosition() - getPosition())*currentspeed);
- move(time);
Add Comment
Please, Sign In to add comment