Changes in common/Player.cpp [3d81c0d:60940f8] in network-game


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/Player.cpp

    r3d81c0d r60940f8  
    7171   memcpy(&this->target.y, buffer+16, 4);
    7272   this->name.assign(buffer+20);
     73
     74   cout << "id: " << this->id << endl;
     75   cout << "pos x: " << this->pos.x << endl;
     76   cout << "pos y: " << this->pos.y << endl;
     77   cout << "target x: " << this->target.x << endl;
     78   cout << "target y: " << this->target.y << endl;
     79   cout << "name: " << this->name << endl;
    7380}
    7481
     
    8895
    8996   // if we're at our target, don't move
    90    if (pos.x == target.x && pos.y == target.y)
    91       cout << "We're already at our target" << endl;
    92    else {
    93       cout << "equals test:" << endl;
    94       float f = 5.0;
    95       int i = 5;
    96 
    97       if (f == i)
    98          cout << "test passed" << endl;
    99       else
    100          cout << "test failed" << endl;
    101 
    102       cout << "Player about to be moved" << endl;
    103       cout << "cur pos x: " << this->pos.x << endl;
    104       cout << "cur pos y: " << this->pos.y << endl;
    105 
     97   if (pos.x != target.x || pos.y != target.y) {
    10698      float pixels = speed * (curTime-timeLastUpdated) / 1000.0;
    107       cout << "We need to move " << pixels << " pixels" << endl;
    10899
    109100      double angle = atan2(target.y-pos.y, target.x-pos.x);
     
    117108         pos.y += sin(angle)*pixels;
    118109      }
    119       cout << "new pos x: " << this->pos.x << endl;
    120       cout << "new pos y: " << this->pos.y << endl;
    121 
    122110   }
    123111
Note: See TracChangeset for help on using the changeset viewer.