I'm supposed space 5 items evenly across the top of the world and 5 accross the bottom of the world. I am very confused about the for loop in general let alone how to place items using it. After reading the book that confused me this is the code I put in the animal class thinking it would set the world up but I keep getting errors. I tried to put the spacing int at 560 but I was redirected by my instructor to use getWidth instead. Even still I am still confused and please ask for your help
public void setup()
{
int numberOfActors = 5;
int spacing = getWidth() / numberOfActors;
addObject(getWidth());
for (int i = 0; i < numberOfActors; i++)
{
addObject(new turtle, spacing / 30 + i * spacing, 280);
addObject(new bug, spacing/30+ * spacing 280));
}
}
