Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Mititiuc <webdevcat@proton.me>2024-07-02 15:19:17 -0700
committerCatalin Mititiuc <webdevcat@proton.me>2024-07-02 15:27:27 -0700
commit71724cc97967a876224d1a4b711843b17256cb0d (patch)
treebf39584668aa2cd8077a01719715663a8b0e3849 /src/modules/game
parent624991870df0e804d64cf4d9359c63435513d61b (diff)
WIP: counters
Diffstat (limited to 'src/modules/game')
-rw-r--r--src/modules/game/soldier.js8
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;