index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
author | Catalin Mititiuc <webdevcat@proton.me> | 2024-07-02 15:19:17 -0700 |
---|---|---|
committer | Catalin Mititiuc <webdevcat@proton.me> | 2024-07-02 15:27:27 -0700 |
commit | 71724cc97967a876224d1a4b711843b17256cb0d (patch) | |
tree | bf39584668aa2cd8077a01719715663a8b0e3849 /src/modules/game | |
parent | 624991870df0e804d64cf4d9359c63435513d61b (diff) |
WIP: counters
Diffstat (limited to 'src/modules/game')
-rw-r--r-- | src/modules/game/soldier.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/modules/game/soldier.js b/src/modules/game/soldier.js index f9c67db..fc3d113 100644 --- a/src/modules/game/soldier.js +++ b/src/modules/game/soldier.js @@ -1,3 +1,5 @@ +import counters from './assets/images/counters.svg'; + const selectedClass = 'selected'; function dataSelector({ dataset: { allegiance, number }}) { @@ -53,15 +55,15 @@ function createTrace(previous, current, selected) { return trace; } -export function createCounter(selected) { +export function createCounter(selected, weapon = 'rifle') { const use = document.createElementNS(svgns, 'use'); const g = document.createElementNS(svgns, 'g'); - // use.setAttributeNS(null, 'href', `#t-${selected.dataset.number}`); - use.setAttributeNS(null, 'href', `counters.svg#rifle`); + use.setAttributeNS(null, 'href', `../../${counters}#${weapon}`); use.classList.add('primary-weapon'); g.classList.add('counter'); g.dataset.allegiance = selected.dataset.allegiance; g.dataset.number = selected.dataset.number; + g.dataset.squad = selected.dataset.squad; g.appendChild(use); return g; |