Example #1
0
void Figure::move(vector<Figure*>& other, int deltaTicks) {
   xMovement(other, deltaTicks);
   yMovement(other, deltaTicks);

   setCamera();

   if (DEBUG_MOVE) {
      cout << "p.x: " << p.x << endl;
      cout << "p.y: " << p.y << endl;
   }
}
void PlayerFigure::move(vector<Figure*>& other, int deltaTicks) {
   cursor.move(other, deltaTicks);
   grabstate = cursor.getGrabState();

   if (grabstate) {
      A.x = p.x + dim.w / 2;
      A.y = p.y + dim.h / 2;
      B.x = cursor.getGrabbableFigure()->getX()
            + cursor.getGrabbableFigure()->getWidth() / 2;
      B.y = cursor.getGrabbableFigure()->getY()
            + cursor.getGrabbableFigure()->getHeight() / 2;

      if (resetVelY) {
         v.y = 0;
         resetVelY = false;
      }
   }

   xMovement(other, deltaTicks);
   yMovement(other, deltaTicks);
   setCamera();
}