# Problem with position for player and 2D camera

I'm not sure I understand how the Matrix class for a 2D camera works in XNA. I have a Player object that I'm trying to position in the middle of the screen and then I have the Camera object that I want to follow the Player. But The position of the player is at the top left corner!?

Preciate som help to understand and to improve my code.

Game1.cs

player = new Player(texturePlayer, new Vector2(screenSizeX / 2, screenSizeY / 2));


And in the Update method:

camera.Position = player.PlayerPosition;


The Camera class:

    class Camera
{
public Vector2 Position { get; set; }
private Viewport viewPort;

// Konstruktor
public Camera(Viewport viewPort)
{
this.viewPort = viewPort;
Position = Vector2.Zero;
}
public Matrix GetViewPortMatrix()
{
return Matrix.CreateTranslation(new Vector3(-Position, 0f));
}
}


I guess there is no need to calcualte an origin for the Matrix when the camera isn't going to rotate!?

And finally some part of the Player class. Note that I'm using a "timer" to achieve a movement of the player in steps. Is this OK or is there a better way to achieve this?

    class Player:GameObjects
{
//public Vector2 Position { get { return position; } }

private int walkingSpeed = 60;
private float walkingTimer = 100;
private float milliSeconds1;

// Konstruktor
public Player(Texture2D texture, Vector2 position) : base(texture, position)
{
}

public void Update(GameTime gameTime)
{
milliSeconds1 += (float)gameTime.ElapsedGameTime.TotalMilliseconds;
}

public Vector2 PlayerPosition
{
get
{
return position;
}
set
{
position = value;
}
}

public void Up()
{
if (milliSeconds1 >= walkingTimer)
{
if(position.Y > 60)
position.Y -= walkingSpeed;

milliSeconds1 = 0;
}
}

public void Down()
{
if (milliSeconds1 >= walkingTimer)
{
if(position.Y < 630)
position.Y += walkingSpeed;

milliSeconds1 = 0;
}
}


camera.Position = player.PlayerPosition - new Vector2(screenSizeX/2f, screenSizeY/2f);