Ver Código Fonte

store color in world map.

Lucas Stadler 12 anos atrás
pai
commit
84c67d5a8c
1 arquivos alterados com 4 adições e 3 exclusões
  1. 4 3
      js/pixl/index.html

+ 4 - 3
js/pixl/index.html

@ -48,12 +48,13 @@
48 48
		}
49 49
50 50
		pixl.draw_pixl = function(pos, color) {
51
			pixl.ctx.fillStyle = color || "black";
51
			var color = color || "black";
52
			pixl.ctx.fillStyle = color;
52 53
			var screen_pos = pixl.to_screen(pos);
53 54
			pixl.ctx.fillRect(screen_pos.x, screen_pos.y, pixl.size, pixl.size);
54
			pixl.world[pos.x + "," + pos.y] = {};
55
			pixl.world[pos.x + "," + pos.y] = {color: color};
55 56
			if (pixl.online && !pos.remote) {
56
				pixl.ws.send(JSON.stringify([{x: pos.x, y: pos.y, color: color || "black"}]));
57
				pixl.ws.send(JSON.stringify([{x: pos.x, y: pos.y, color: color}]));
57 58
			}
58 59
		}
59 60