Is there a way for me to create a path of colored tiles for a character to follow, where the character's path matches the color of the character cube itself? I currently have this code (found in another post):
<html><head>
<style>
body{ background-color: lavenderblush; padding:10px; }
#canvas{border:1px solid blue;}
</style>
</head>
<body>
<canvas id="canvas" width="1000" height="1000"></canvas>
<script type="text/javascript">
var canvas=document.getElementById("canvas");
var ctx=canvas.getContext("2d");
var cw=canvas.width;
var ch=canvas.height;
var colwidth=cw/20;
var rowheight=ch/20;
for(var y=0;y<20;y++){
for(var x=0;x<20;x++){
ctx.fillStyle=randomColor();
ctx.fillRect(x*colwidth,y*rowheight,colwidth,rowheight);
ctx.strokeRect(x*colwidth,y*rowheight,colwidth,rowheight);
}}
function randomColor(){
return('#'+Math.floor(Math.random()*98765432).toString(16));
}
</script>
</body></html>