if (texture == null) {
continue;
}
String name = Util.getFullName(each);
Sprite sprite = new Sprite(point.x, point.y, name, texture);
spritelist.add(sprite);
offsetlist.add(point);
}
int commonX = 0;
int commonY = 0;
int width = 0;
int height = 0;
for (int index = 0; index < spritelist.size(); index++) {
Point point = offsetlist.get(index);
Sprite sprite = spritelist.get(index);
commonX += point.x;
commonY += point.y;
if (width < sprite.getWidth()) {
width = sprite.getWidth();
}
if (height < sprite.getHeight()) {
height = sprite.getHeight();
}
}
int destX = commonX / offsetlist.size() + width / 2;
int destY = commonY / offsetlist.size() + height / 2;
for (int index = 0; index < spritelist.size(); index++) {
Point point = offsetlist.get(index);
Sprite sprite = spritelist.get(index);
sprite.offsetX = destX - point.x;
sprite.offsetY = destY - point.y;
}