Skip to content
Snippets Groups Projects
Commit 4166263c authored by Paolo.Brasolin's avatar Paolo.Brasolin
Browse files

feat: #fe parameterize foe duration

parent 5b5cf807
No related branches found
No related tags found
No related merge requests found
...@@ -14,8 +14,11 @@ class Foe { ...@@ -14,8 +14,11 @@ class Foe {
critter: Critter; critter: Critter;
clue: Clue; clue: Clue;
constructor(scene: FightScene) { duration: number;
constructor(scene: FightScene, duration = 15) {
this.scene = scene; this.scene = scene;
this.duration = duration;
} }
async initialize() { async initialize() {
...@@ -29,7 +32,9 @@ class Foe { ...@@ -29,7 +32,9 @@ class Foe {
).data; ).data;
this.clue = new Clue(this.scene, this.beWord); this.clue = new Clue(this.scene, this.beWord);
this.critter = new Critter(this.scene); // TODO: this is the time to reach a collision w/player, but maybe we should just use the transversal of the full screen.
const critterSpeed = this.scene.player.getBounds().left / this.duration;
this.critter = new Critter(this.scene, critterSpeed);
this.scene.foes.push(this); this.scene.foes.push(this);
const overlap = this.scene.physics.add.overlap( const overlap = this.scene.physics.add.overlap(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment