I switched them around in my tile class like so:
private void loadLevel() {
int[][] levelData = new int[][] {
{0,0,0,0,1,0,0,0,0,0},
{0,0,0,0,1,0,0,0,0,0},
{3,3,3,3,1,3,3,3,3,3},
{0,0,0,0,1,0,0,0,0,0},
{0,0,0,0,1,0,0,0,0,0},
{0,0,0,0,2,1,0,0,0,0},
{0,0,0,0,0,1,0,0,0,0},
{0,0,0,0,0,1,0,0,0,0},
{0,0,0,0,0,1,0,0,0,0},
{0,0,0,0,0,1,0,0,0,0}
};
for (int y = 0; y < 9; y++) {
for (int x = 0; x < 9; x++) {
Tile tempTile = new Tile(levelData[y][x],new Vector2(y,x));
tileList.add(tempTile);
}
}
}
public void Render(SpriteBatch batch) {
for (int i = 0; i < tileList.size(); i++) {
tileList.get(i).render(batch);
}
}
But in my tile class where I actually draw them, it calls for x and y so I left them…Do I use y for everywhere x is referred and vice versa?
public void render(SpriteBatch batch) {
if (tileType == 0) {
batch.draw(new TextureRegion(tileTexture, 0, 0, 16, 16), tilePos.x,
tilePos.y);
} else {
if (tileType == 1) {
batch.draw(new TextureRegion(tileTexture, 0, 16, 16, 16),
tilePos.x, tilePos.y);
} else {
if (tileType == 2) {
batch.draw(new TextureRegion(tileTexture, 16, 0, 16, 16),
tilePos.x, tilePos.y);
} else {
if (tileType == 3) {
batch.draw(new TextureRegion(tileTexture, 16, 16, 16,
16), tilePos.x, tilePos.y);
}
}
}
}
}