From 2cb740e9235a93e302586747bbb22c929068b6f6 Mon Sep 17 00:00:00 2001 From: brian cully Date: Wed, 24 Dec 2025 13:03:27 -0500 Subject: part 4: create 2 robos on start --- site/game.mjs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'site/game.mjs') diff --git a/site/game.mjs b/site/game.mjs index f58f2c2..0fb5974 100644 --- a/site/game.mjs +++ b/site/game.mjs @@ -45,10 +45,10 @@ export default class extends HTMLElement { this.#tickRate.onchange({ target: this.#tickRate }); this.addRobo(); + this.addRobo(); } addRobo() { - console.debug('bjc pre inspector', this.#inspectors); const i = this.#robos.length; const { x, y } = this.#arena.randStart(); const robo = { @@ -68,8 +68,8 @@ export default class extends HTMLElement { // that's attached is to append the template, then fetch that // out of the dom. neither cloneNode(true|false) nor // document.importNode(true|false) worked to fire the event - // listener. - this.#inspectorsSection.appendChild(this.#inspectorTemplate.content); + // listener if attached before adding it to the dom. + this.#inspectorsSection.appendChild(this.#inspectorTemplate.content.cloneNode(true)); const inspector = this.#inspectorsSection.children[this.#inspectorsSection.children.length-1]; inspector.addEventListener(Inspector.compileRequest, e => { console.debug('compiling for worker', e.detail.text, robo.worker); -- cgit v1.3