I want to create a random tiled map for my game, this is what I have so far:
switch(MathUtils.random(2)){
case 0:
tileX+=16;
loadedTiles ++;
//game.batch.draw(tile1, tileX, tileY);
System.out.print("tile1");
currentTile = tile1;
break;
case 1:
tileX+=16;
loadedTiles ++;
//game.batch.draw(tile2, tileX, tileY);
System.out.print("tile2");
currentTile = tile2;
break;
case 2:
tileX+=16;
loadedTiles ++;
//game.batch.draw(tile3, tileX, tileY);
System.out.print("tile3");
currentTile = tile3;
break;
}
game.batch.begin();
game.batch.draw(currentTile, tileX, tileY);
game.batch.end();
}
Instead of rendering them each individually i would like to add them to an array and render them all together, so if i have an array such as this:
ArrayList<Texture> tiles;
Then add something to all of he case options like:
tiles.add(tile1);
Problem:
How do i render the array and get the relevent co-ordinates for them to be rendered, does this get added to the array?