diff options
| author | brian cully <bjc@spork.org> | 2025-12-24 13:03:27 -0500 |
|---|---|---|
| committer | brian cully <bjc@spork.org> | 2025-12-24 13:03:27 -0500 |
| commit | 2cb740e9235a93e302586747bbb22c929068b6f6 (patch) | |
| tree | fe70759909d0ce63a1d399a39735ea9d93640ff8 /site/game.mjs | |
| parent | e9bce2376ed7fc3d93fad5c8dd0e749d907e8a00 (diff) | |
| download | automathon-2cb740e9235a93e302586747bbb22c929068b6f6.tar.gz automathon-2cb740e9235a93e302586747bbb22c929068b6f6.zip | |
part 4: create 2 robos on start
Diffstat (limited to 'site/game.mjs')
| -rw-r--r-- | site/game.mjs | 6 |
1 files changed, 3 insertions, 3 deletions
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); |
