Web Dev Solutions

Catalin Mititiuc

From 1833dfebf19cf4478a74d907b52c9e569879646f Mon Sep 17 00:00:00 2001 From: Catalin Mititiuc Date: Thu, 25 Apr 2024 17:21:46 -0700 Subject: WIP: firing arcs algo --- src/modules/game.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/modules/game.js') 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 }); } } -- cgit v1.2.3