diff --git a/mods/paint_event.js b/mods/paint_event.js new file mode 100644 index 00000000..9792abf3 --- /dev/null +++ b/mods/paint_event.js @@ -0,0 +1,17 @@ +randomEvents.paint = function() { + // set the color of a random circle to a random color + var x = Math.floor(Math.random()*(width-1))+1; + var y = Math.floor(Math.random()*(height-1))+1; + var randomR = Math.floor(Math.random() * 256); + var randomG = Math.floor(Math.random() * 256); + var randomB = Math.floor(Math.random() * 256); + var radius = Math.floor(Math.random()*4)+3; + var rColor = "rgb(" + randomR + "," + randomG + "," + randomB + ")"; + var coords = circleCoords(x,y,radius); + for (var i = 0; i < coords.length; i++) { + var coord = coords[i]; + if (!outOfBounds(coord.x,coord.y) && !isEmpty(coord.x,coord.y)) { + pixelMap[coord.x][coord.y].color = rColor; + }; + }; +}; \ No newline at end of file