Advertisement
Guest User

Untitled

a guest
Aug 17th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.75 KB | None | 0 0
  1. void Player::updateYPos(int iN) {
  2.     bool bLEFT, bRIGHT;
  3.    
  4.     if (iN > 0) {
  5.         bLEFT  = CCore::getMap()->checkCollisionLB((int)(fXPos - CCore::getMap()->getXPos() + 2), (int)fYPos + iN, getHitBoxY(), true);
  6.         bRIGHT = CCore::getMap()->checkCollisionRB((int)(fXPos - CCore::getMap()->getXPos() - 2), (int)fYPos + iN, getHitBoxX(), getHitBoxY(), true);
  7.  
  8.         if (!bLEFT && !bRIGHT) {
  9.             fYPos += iN;
  10.         } else {
  11.             if (jumpState == 2) {
  12.                 jumpState = 0;
  13.             }
  14.             updateYPos(iN - 1);
  15.         }
  16.     } else if(iN < 0) {
  17.         bLEFT  = CCore::getMap()->checkCollisionLT((int)(fXPos - CCore::getMap()->getXPos() + 2), (int)fYPos + iN, false);
  18.         bRIGHT = CCore::getMap()->checkCollisionRT((int)(fXPos - CCore::getMap()->getXPos() - 2), (int)fYPos + iN, getHitBoxX(), false);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement