I am trying to create a program that lays out a bunch of tiles that change color when you click on them. However, I'm trying to create a loop that would iteratively modify variables. I am using this as a template. Any help would be appreciated.
function updateGameArea(){
myGameArea.clear();
myGameTile1.update();
myGameTile2.update();
myGameTile3.update();
...
}
var myGameArea = {
...
window.addEventListener("mousedown",function(e){
myGameArea.x = e.pageX;
myGameArea.y = e.pageY;
if(myGameArea.x <= 320 && myGameArea.y <= 320){
for(var y=0;y<10;y++){
for(var x=0;x<10;x++){
myGameTile+((y+1)*10+(x+1)) = component(32,32,"#000000",0,0); //I know this doesnt work, but this is what I imagine it would look something like
}
}
}
...