public void alignCamera(GameTime gameTime, LLESprite playerCharacter, LLESprite partnerCharacter, Vector2 windowSize) { if ((mCameraVelocityX < 0.0f && cameraX < mCameraDestX) || (mCameraVelocityX > 0.0f && cameraX > mCameraDestX)) { cameraX = mCameraDestX; mCameraVelocityX = 0.0f; } if ((mCameraVelocityY < 0.0f && cameraY < mCameraDestY) || (mCameraVelocityY > 0.0f && cameraY > mCameraDestY)) { cameraY = mCameraDestY; mCameraVelocityY = 0.0f; } if (mCameraVelocityX == 0.0f && mCameraVelocityY == 0.0f) { mAlignCamera = false; playerCharacter.setXVel(0.0f); playerCharacter.setYVel(0.0f); partnerCharacter.setXVel(0.0f); partnerCharacter.setYVel(0.0f); return; } cameraX += (gameTime.ElapsedGameTime.Ticks / 100000.0f) * mCameraVelocityX; cameraY += (gameTime.ElapsedGameTime.Ticks / 100000.0f) * mCameraVelocityY; //Move playerCharacter and partnerCharacter playerCharacter.setX(playerCharacter.getX() - ((gameTime.ElapsedGameTime.Ticks / 100000.0f) * mCameraVelocityX)); playerCharacter.setY(playerCharacter.getY() - ((gameTime.ElapsedGameTime.Ticks / 100000.0f) * mCameraVelocityY)); playerCharacter.updateRectangle(); if (partnerCharacter != null && partnerCharacter.isVisible()) { partnerCharacter.setX(partnerCharacter.getX() - ((gameTime.ElapsedGameTime.Ticks / 100000.0f) * mCameraVelocityX)); partnerCharacter.setY(partnerCharacter.getY() - ((gameTime.ElapsedGameTime.Ticks / 100000.0f) * mCameraVelocityY)); partnerCharacter.updateRectangle(); } }