My problem is this, i have a platformer game that uses a String for the tile map, such as this
String map[] = {
"11111111111111111111111111111111111111111111111111111111111111111111111",
"10000000000000000000000220000000000000000000000000000000000000000000001",
"10000000000000000000220000000000000000000000000000000000000000000000001",
"10000000000000002200000000000000000000000000001110000000000000000000001",
"1000000000E022000000000000000000000000000001111110000000022222200000001",
"10000000022000000000000000000000000000011111111111000000000000000000001",
"10000000000000000000000000000000000011111111111111111111111000011111111",
"11111111111111111111111111111111111111111111111111111111111111111111111"
};
Now the problem is that sometimes i need to edit the map while the game is playing, such as changing an E to a 0 or something to the affect, but everytime i want to go and change an individual character in the map i get an “unexpected type” error. This is how i try to do it
for (int i = 0; i<map.length; i++) {
for (int j = 0; j < map[0].length(); j++) {
char c = map[i].charAt(j);
if (c == 'E') {
enemy[enemyIndex] = new Enemy(elite,eliteAttack,i*tileW,j*tileH,this, 3);
enemyIndex++;
map[i].charAt(j) = "0";
}
}
}
Right on the line where i try to change the value of the character in the map, i get an “unexpected type” error pointing to the oppening round bracket. I know im probably overthinking this and its easier than i think, but i really need help on how to do this. Thanks