Advertisement
Guest User

Untitled

a guest
Jan 26th, 2020
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     case DIRECTION_Y:
  2.                 if (oldTileX != newTileX) {
  3.                     if (this._isSurface(scene, newTileX, oldTileY)) {
  4.                         pos.tileX = newTileX;
  5.                         pos.tileY = oldTileY;
  6.                         pos.sceneX = Math.floor(startPosX / WALL_SIZE) * WALL_SIZE;
  7.                         if (xDifference >= 0) {
  8.                             pos.sceneX += WALL_SIZE;
  9.                             pos.side = SIDE_LEFT;
  10.                         }
  11.                         else {
  12.                             pos.side = SIDE_RIGHT;
  13.                         }
  14.                         pos.sceneY = this._getEndPosA(controlSizeY, controlSizeX, this._raySourcePosition.y, this._raySourcePosition.x, pos.sceneX);
  15.                         surfaceEarned = true;
  16.                     }
  17.                 }
  18.                 else {
  19.                     if (this._isSurface(scene, newTileX, newTileY)) {
  20.                         pos.tileX = newTileX;
  21.                         pos.tileY = newTileY;
  22.                         pos.sceneX = endPosX;
  23.                         pos.sceneY = endPosY;
  24.                         pos.side = yDifference >= 0 ? SIDE_UP : SIDE_DOWN;
  25.                         surfaceEarned = true;
  26.                     }
  27.                 }
  28.                 break;
  29.             default:
  30.                 return undefined;
  31.         }//*/
  32.         return (surfaceEarned ? pos : undefined);
  33.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement