terrainyImage = terrainy.getImage();
createTerrainBody2(-terrainyImage.getWidth()/2, -terrainyImage.getHeight()/2);
for (int i = 0; i < Constants.BEAVERS_PER_TEAM; i++) {
int[] coord = randomFreeCoordinate(20);
if (coord[0] < 0) p1.getTeam()[i].setBody(new DynamicBody(new Circle(10.0f), -100*i, 1300));
else p1.getTeam()[i].setBody(new DynamicBody(new Circle(10.0f), (coord[0]-terrainyImage.getWidth()/2), (coord[1]-terrainyImage.getHeight()/2)));
p1.getTeam()[i].getBody().setDensity(1);
p1.getTeam()[i].getBody().setFriction(1000);
p1.getTeam()[i].getBody().setRestitution(0f);
p1.getTeam()[i].getBody().setAngularDamping(1f);
p1.getTeam()[i].getBody().setFixedRotation(true);
world.add(p1.getTeam()[i].getBody());
}
for (int i = 0; i < Constants.BEAVERS_PER_TEAM; i++) {
int[] coord = randomFreeCoordinate(20);
if (coord[0] < 0) p2.getTeam()[i].setBody(new DynamicBody(new Circle(10.0f), -100*i, 1300));
else p2.getTeam()[i].setBody(new DynamicBody(new Circle(10.0f), (coord[0]-terrainyImage.getWidth()/2), (coord[1]-terrainyImage.getHeight()/2)));
p2.getTeam()[i].getBody().setDensity(1);
p2.getTeam()[i].getBody().setFriction(1000);
p2.getTeam()[i].getBody().setRestitution(0f);
p2.getTeam()[i].getBody().setAngularDamping(1f);
p2.getTeam()[i].getBody().setFixedRotation(true);