I've got a camera that places the character about a 1/4 way into the screen. The problem I'm having is that when the character moves left the character stays in place now placing the character 3/4 the way into the screen. I tried rectifying the issue with the following code.
public Vector2 Position = Vector2.Zero;
public Matrix TransformMatrix
{
get
{
return Matrix.CreateTranslation(new Vector3(-Position, 0f));
}
}
public void LockToTarget(Vector2 charPosition,Rectangle bounds, int screenWidth, int screenHeight, bool direction)
{
float multiplyBy = 0;
if(direction)
multiplyBy = 0.25f;
else if(!direction)
multiplyBy = 0.75f;
Position.X = charPosition.X + (bounds.Width * multiplyBy) - (screenWidth * multiplyBy);
Position.Y = charPosition.Y + (bounds.Height / 2) - (screenHeight / 2);
}
it pretty much gets a boolean value telling it if the character is moving towards the left or right (true = right, false = left), the problem is that the when the character starts moving from on direction to another he simply jumps to the other side of the screen and I'm not sure how to get the camera to move position instead.
any help with this would be really great.