Simple ArrayIndex problem

Hello,

Same idea… at the end of and after the loop finish things off.

void draw() 
  {
  translate(500, 500);

  for (int i = 0; i < positions.size()-1; i++) 
    {
    a = positions.get(i);
    b = positions.get(i+1);

    strokeWeight(2);
    ellipse(a.x, a.y, 10, 10);
    line(a.x, a.y, b.x, b.y);
    }

    a = positions.get(?);
    line(?);
    ellipse(?);
    }
1 Like