}
}
}
if (canPlace) {
PlacableAsset a = new PlacableAsset(asset, mouseGridX, mouseGridY, selectedLayer);
ADXRectangle r = new ADXRectangle(mouseGridX, mouseGridY, a.asset.width, a.asset.height);
ADXRectangle r2 = new ADXRectangle(0, 0, 1, 1);
boolean place = true;
for (PlacableAsset p : lPAsset) {
r2.setX(p.x);
r2.setY(p.y);
r2.setWidth(p.asset.width);
r2.setHeight(p.asset.height);
if (r.collides(r2)) {
place = false;
break;
}
}
if (place) {
lPAsset.add(a);
}
}
}
}
}
if (input.getButton(ADXInput.MOUSE_RIGHT)) {
if (!drawAssets || input.getMouseX() > 256) {
Layer l = lLayer.get(selectedLayer);
ADXRectangle r = new ADXRectangle(mouseGridX, mouseGridY, 1, 1);
ADXRectangle r2 = new ADXRectangle(0, 0, 1, 1);
PlacableAsset p;
for (int i = lPAsset.size() - 1; i >= 0; i--) {
p = lPAsset.get(i);
if (p.layer == l.code) {
r2.setX(p.x);
r2.setY(p.y);
r2.setWidth(p.asset.width);
r2.setHeight(p.asset.height);
if (r.collides(r2)) {
lPAsset.remove(i);
}
}
}