From 7b98e9c6efd97470248fb244a20c3dacb2942cd1 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Sun, 17 Mar 2024 14:30:04 +0100 Subject: Add initial client. --- play.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 play.js (limited to 'play.js') diff --git a/play.js b/play.js new file mode 100644 index 0000000..96a53b9 --- /dev/null +++ b/play.js @@ -0,0 +1,19 @@ +const cities = data.cities +const last_city = cities.name.length - 1 + +const ui = { + map_pieces: document.getElementById("pieces"), + cities: [], +} + +function on_init() { + for (let s = 0; s <= last_city; ++s) { + let e = ui.cities[s] = document.createElement("div") + e.className = "city" + e.style.left = (cities.x[s] - 9) + "px" + e.style.top = (cities.y[s] - 9) + "px" + map_pieces.appendChild(e) + } +} + +on_init() -- cgit v1.2.3