public void Update(GameTime gameTime)
{
if (bActive && bMovingTowardsTarget)
{
if (!(v2Target == null))
{
// Get a vector pointing from the current location of the sprite
// to the destination.
Vector2 Delta = new Vector2(v2Target.X - asSprite.X, v2Target.Y - asSprite.Y);
if (Delta.Length() > Speed)
{
Delta.Normalize();
Delta *= Speed;
Position += Delta;
}
else
{
if (v2Target == asSprite.Position)
{
if (bPathing)
{
if (queuePath.Count > 0)
{
v2Target = queuePath.Dequeue();
if (bLoopPath)
{
queuePath.Enqueue(v2Target);
}
}
else
{
if (!(sEndPathAnimation == null))
{
if (!(Sprite.CurrentAnimation == sEndPathAnimation))
{
Sprite.CurrentAnimation = sEndPathAnimation;
}
}
if (bDeactivateAtEndOfPath)
{
IsActive = false;
}
if (bHideAtEndOfPath)
{
IsVisible = false;
}
}
}
}
else
{
asSprite.Position = v2Target;
}
}
}
}
if (bActive)
asSprite.Update(gameTime);
}
This is my update and
for (int i = 0; i < 50; i++)
{
float angle = (float)(i / 100.0 * Math.PI * 2);
vertices[i].Position = new Vector3(200 + (float)Math.Cos(angle) * 100, 200 + (float)Math.Sin(angle) * 100, 0);
Console.WriteLine(" vertices is :" +" ( +"+ vertices[i].Position.X + " , " + vertices[i].Position.Y + " )");
vertices[i].Color = Color.Black;
}
vertices[49] = vertices[0];
for (int i = 0; i < 100; i++)
{
// myTank.AddPathNode(new Vector2(vertices[i].Position.X, vertices[i].Position.Y));
}
I don't know why but the sprite doesn't move smoothly here and doesn't follow on half circle here. I need you guys help here!