Ok, done, though I still get the error message 'variable tile is already defined in method moveSelected(Tile,int,int)' now it's just from the second for statement.
public void moveSelected(Tile tile, int dx, int dy)
{
Tile tile2 = makeSwap(tile, dx, dy);
if (matchingSetFound(tile) || matchingSetFound(tile2))
{
Tile.setSelected(null);
List<Tile> tiles = new ArrayList();
tiles.addAll(getHorizontalMatchingTiles(tile.getX(), tile.getY()));
tiles.addAll(getVerticalMatchingTiles(tile.getX(), tile.getY()));
tiles.addAll(getHorizontalMatchingTiles(tile2.getX(), tile2.getY()));
tiles.addAll(getVerticalMatchingTiles(tile2.getX(), tile2.getY()));
for (int n=0; n<tiles.size(); n++)
{
Tile tile = tiles.get(n);
Tile dummy = new Dummy();
addObject(dummy, tile.getX(), tile.getY());
removeObject(tile);
tiles.set(n, dummy);
}
for (Tile tile : tiles)
{
int x = tile.getX(), y = tile.getY();
Tile actor = null;
while (!canReplace(actor, x, y)) actor = getRandomTile();
addObject(actor, x, y);
}
}else{
makeSwap(tile2, dx, dy);
}
}
