I have recently migrated from JS and the Processing library to LibGDX with Java. In my time with JS, I have used code like this, for level design:
var level = [
" aaaaaaaaa",
" aaaaaaaaa",
" aaaaaaaaa",
" aaaaaaaaa",
" aaaaaaaaa",
"aaaaaaaaaa",
"aaaaaaaaaa",
"saaaggaaaa",
"ggggccgggg",
"cccccccccc",
"aaaaaaaaaa",
"aaaaaaaaaa",
"cccccccccc"
];
With this, I made a for loop and switch like so:
for(var c = 0; c < level.length; c ++){
for(var r = 0; r < level[c].length; r ++){
switch(level[c][r]) {
case 'a':
rect(r*40, c*40, 40, 40);
break;
case 'g':
...
}
}
}
This checks through each character in each string in the array. Due to Java's more abstract system of variables and lack of interchangeable array and string properties, I have found it very difficult to do this same thing in Java. Does anyone know of a way that I can? Thanks in advance!