Guest User

Untitled

a guest
May 20th, 2018
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. // -- EVASION -- //
  2.         for (int i=0; i<map->crowd.size(); i++) {
  3.             if (this!=map->crowd[i] && map->crowd[i]->visible) {
  4.                 float x = (getPosition()+time*velocity - map->crowd[i]->getPosition()).x;
  5.                 float y = (getPosition()+time*velocity - map->crowd[i]->getPosition()).y;
  6.                 if (x*x+y*y <= (radius + map->crowd[i]->radius)*(radius + map->crowd[i]->radius)) {
  7.                     moveLeft(time*10);
  8.                     break;
  9.                 }
  10.             }
  11.         }
  12.         setVelocity(normalize(nextNode->getPosition() - getPosition())*currentspeed);
  13.         move(time);
Add Comment
Please, Sign In to add comment