public void Update(GameTime gameTime)
{
var position = new Vector2f();
var x = this.X * 32;
var y = this.Y * 32;
if (x < this.Sprite.Position.X)
{
position.X = this.Sprite.Position.X - (this.Speed * gameTime.UpdateTime);
if (x >= position.X)
{
position.X = x;
}
}
else if (x > this.Sprite.Position.X)
{
position.X = this.Sprite.Position.X + (this.Speed * gameTime.UpdateTime);
if (x <= position.X)
{
position.X = x;
}
}
else
{
position.X = x;
}
if (y < this.Sprite.Position.Y)
{
position.Y = this.Sprite.Position.Y - (this.Speed * gameTime.UpdateTime);
if (y >= position.Y)
{
position.Y = y;
}
}
else if (y > this.Sprite.Position.Y)
{
position.Y = this.Sprite.Position.Y + (this.Speed * gameTime.UpdateTime);
if (y <= position.Y)
{
position.Y = y;
}
}
else
{
position.Y = y;
}
this.Sprite.Position = position;
}