spaces[1] = new Space(x1,y1+height,width,height);
spaces[2] = new Space(x1+width,y1,width,height);
spaces[3] = new Space(x1+width,y1+height,width,height);
for (int i=0;i<size();i++) {
Body body = get(i);
for (int j=0;j<4;j++) {
if (spaces[j].touches(body.getShape().getBounds(),
body.getPosition().getX(),
body.getPosition().getY())) {
spaces[j].add(body);
}
}
}