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

feat: #fe sent game start to #be

parent db9330bd
No related branches found
No related tags found
No related merge requests found
...@@ -8,11 +8,14 @@ import backend from "./backend"; ...@@ -8,11 +8,14 @@ import backend from "./backend";
import levenshtein from "damerau-levenshtein"; import levenshtein from "damerau-levenshtein";
import Clue from "./clue"; import Clue from "./clue";
import * as Types from "../../../backend/src/types";
export default class FightScene extends Phaser.Scene { export default class FightScene extends Phaser.Scene {
foes: Array<Critter>; foes: Array<Critter>;
ground: Phaser.Types.Physics.Arcade.ImageWithStaticBody; ground: Phaser.Types.Physics.Arcade.ImageWithStaticBody;
player: Phaser.Types.Physics.Arcade.SpriteWithDynamicBody; player: Phaser.Types.Physics.Arcade.SpriteWithDynamicBody;
cluesGroup: Phaser.Physics.Arcade.Group; cluesGroup: Phaser.Physics.Arcade.Group;
beGame: Types.Game;
constructor() { constructor() {
super("fight"); super("fight");
...@@ -75,7 +78,7 @@ export default class FightScene extends Phaser.Scene { ...@@ -75,7 +78,7 @@ export default class FightScene extends Phaser.Scene {
}); });
} }
create() { async create() {
this.initCluesGroup(); this.initCluesGroup();
// Draw background forest // Draw background forest
["b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "b10"].forEach( ["b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", "b8", "b9", "b10"].forEach(
...@@ -161,6 +164,14 @@ export default class FightScene extends Phaser.Scene { ...@@ -161,6 +164,14 @@ export default class FightScene extends Phaser.Scene {
); );
this.scale.refresh(); this.scale.refresh();
initAndBindGuessPreview(this); initAndBindGuessPreview(this);
this.beGame = (await backend.createGame()).data;
this.beGame.began_at = new Date().toISOString();
await backend.updateGame(this.beGame.id, {
began_at: this.beGame.began_at,
ended_at: null,
});
gameStart(this); gameStart(this);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment