Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (function() {
- 'use strict';
- var imageX = 0;
- var imageY = 35;
- var image = [
- " ",
- " ",
- "####### # ## ### ####### ",
- "# # # # ## ## # # ",
- "# ### # # # # ### # ",
- "# ### # # # # # # ### # ",
- "# ### # # ### # # ### # ",
- "# # # ### # # ## # # ",
- "####### # # # # # # # ####### ",
- " ## # # ## ",
- " #### ## # # ## # ",
- " ### ### ### ## # ## ",
- " ### #### ###### ### # # ",
- "##### # # ## # # # ",
- "### # # ##### # # ",
- "## # ## #### # # ## # # # ",
- " ## #### ### # # # # # # ",
- "# # # ### # ### # ## ",
- "# # # ## #### ### ### ## ",
- "#### ## # ### ## ###### # ",
- " # ## # # # ### # # # ",
- " ## # ##### ## # ## ### ",
- "## ## ## # # # ######### # ",
- " # # ### # # # ### ",
- "####### # # # #### # # ### ",
- "# # # ### ### # ## # ",
- "# ### # ## # #### ######## ",
- "# ### # ## # ## # #### ",
- "# ### # ### # # ### ",
- "# # ### ##### # ### ",
- "####### ## # ### # ",
- " ",
- ];
- var colors = {
- " ": 0, // white
- "#": 3, // black
- };
- var image_data = [];
- for (var relY = 0; relY < image.length; relY++) {
- var row = image[relY];
- for (var relX = 0; relX < row.length; relX++) {
- var color = colors[row[relX]];
- var absX = imageX + relX;
- var absY = imageY + relY;
- image_data.push(absX);
- image_data.push(absY);
- image_data.push(color);
- }
- }
- var p = r.place;
- r.placeModule("placePaintBot", function(loader) {
- var c = loader("canvasse");
- setInterval(function() {
- if (p.getCooldownTimeRemaining() > 200) {
- return;
- }
- for (var i = 0; i < image_data.length; i += 3) {
- var j = Math.floor((Math.random() * image_data.length) / 3) * 3;
- var x = image_data[j + 0];
- var y = image_data[j + 1];
- var color = image_data[j + 2];
- var currentColor = p.state[c.getIndexFromCoords(x, y)];
- if (currentColor != color) {
- console.log("set color for", x, y, "old", currentColor, "new", color);
- p.setColor(color);
- p.drawTile(x, y);
- return;
- }
- }
- console.log("noop");
- }, 1500);
- });
- })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement