I am currently working in a worm clone and I am having trouble drawing the worm's body to the screen. I am trying to draw the worm's head, 2 body parts, and then the tail. It is drawing the head, 1 body part, and then the tail. The body part is drawing right behind the head as I want it to, and then there is a space where the second body part should be drawing, then the tail. Any assistance would be greatly appreciated.
Update():
switch (currentDirection)
{
case Direction.Right:
bodyPosition.X = wormHeadPosition.X - wormBodyWidth + 1;
wormTailPosition.X = bodyPosition.X - ((wormBodyTexture.Count - 1) * wormBodyWidth) - wormTailWidth + 2;
bodyPosition.Y = wormHeadPosition.Y;
wormTailPosition.Y = bodyPosition.Y;
wormBodyPosition[0] = bodyPosition;
for (int i = 1; i < wormBodyTexture.Count; i++)
{
bodyPosition.X += -wormBodyWidth + 1;
wormBodyPosition = bodyposition;
}
break;
Draw():
public void Draw(SpriteBatch spriteBatch)
{
spriteBatch.Draw(wigglesTail, wormTailPosition, Color.White);
for (int i = 0; i < wormBodyTexture.Count - 1; i++)
{
spriteBatch.Draw(wormBodyTexture, wormBodyPosition, Color.White);
}
spriteBatch.Draw(wigglesHead, wormHeadPosition, Color.White);
}