Web Dev Solutions

Catalin Mititiuc

aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCatalin Mititiuc <webdevcat@proton.me>2024-04-25 17:21:46 -0700
committerCatalin Mititiuc <webdevcat@proton.me>2024-04-25 17:21:46 -0700
commit1833dfebf19cf4478a74d907b52c9e569879646f (patch)
tree0b65d1a9019b3bd9ba3b2ffc34898a1dce77f857 /src/modules/game.js
parent7f0c19becd5979a16d9298cae9f6ff8a6f96d9c2 (diff)
WIP: firing arcs algo
Diffstat (limited to 'src/modules/game.js')
-rw-r--r--src/modules/game.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/modules/game.js b/src/modules/game.js
index c22dc9d..40d0623 100644
--- a/src/modules/game.js
+++ b/src/modules/game.js
@@ -1,4 +1,4 @@
-import firingArc from './game/firingArc.js';
+import FiringArc from './game/firingArc.js';
import SightLine from './game/sightLine.js';
import Counter from './game/counter.js';
@@ -10,11 +10,15 @@ export default class Game {
constructor(svg) {
this.svg = svg;
- this.firingArc = new firingArc(svg);
+ this.firingArc = new FiringArc(svg);
this.sightLine = new SightLine(svg);
this.counter = new Counter(svg);
this.setUpCells();
+
+ let counter = this.counter.getCounter({ dataset: { allegiance: 'davion', number: '1' }});
+ this.counter.place(counter, this.getCell(17, 25));
+ this.select(counter);
}
getCells() {
@@ -97,12 +101,14 @@ export default class Game {
select(selected) {
const counter = this.counter.getCounter(selected);
+ console.log(counter);
+
if (counter) {
this.unSelect();
this.placing.push(counter);
counter.classList.add(this.counter.selectedClass);
this.firingArc.get(counter).forEach(el => el.removeAttribute('clip-path'));
- this.selectCallback({ prone: this.counter.hasProne(counter), ...counter.dataset });
+ this.selectCallback && this.selectCallback({ prone: this.counter.hasProne(counter), ...counter.dataset });
}
}