2D Array with ArrayList for map

So, here I am again…Feeling like a newbie. It’s been a while since i’ve coded anything and i’m trying to get back into it again…so i’m making a tower defense game. I’m just playing around right now with the map.

Basically, i’ve got a Level class and a Tile class. The tile class just holds the tile information like this:


public class Tile {

	private int tileType;
	private boolean walkable;
	private Vector2 tilePos;
	public Tile(int type, Vector2 pos) {
		tileType = type;
		tilePos = new Vector2(pos);
	}
	
	
public Vector2 getPos() {
	return tilePos;
}
	
public boolean isWalkable() {
	return walkable;
}


In my Level class, i’ve got a 2d array which determines which tile is where:


private void loadLevel(int width,int height) {
	int[][] levelData = new int[][] {
			{0,0,0,0,0,0,0,0,0,0},
			{0,0,0,0,0,0,0,0,0,0},
			{0,0,0,0,0,0,0,0,0,0},
			{0,0,0,0,0,0,0,0,0,0},
			{0,0,0,0,0,0,0,0,0,0},
			{0,0,0,0,0,0,0,0,0,0},
			{0,0,0,0,0,0,0,0,0,0},
			{0,0,0,0,0,0,0,0,0,0},
			{0,0,0,0,0,0,0,0,0,0},
			{0,0,0,0,0,0,0,0,0,0}
	};
	

Simple…So what i’m trying to figure out, is how to actually keep track of the tiles if that makes sense. I’m going to put my render method in the level class and will iterate through the level to draw the maps…I was going to use a for loop and add each tile to an arraylist, then iterate through the arraylist in my render method to draw each tile in the correct place and the correct tile…But, I remember reading that an arraylist would be a bad way to do this and it just doesn’t seem like a good way…

I feel like i’ve taken one step forward and 10 back every time I take a break from java. I should be way more advanced than I am for as long as I have been messing around with java. Any suggestions or information would be greatly appreciated. I do well for a while, then get stuck and take a break, come back and am in the situation I am in now. Very frustrating…