diff --git a/front/src/Phaser/Game/GameScene.ts b/front/src/Phaser/Game/GameScene.ts index 39e486d1..f449f076 100644 --- a/front/src/Phaser/Game/GameScene.ts +++ b/front/src/Phaser/Game/GameScene.ts @@ -42,7 +42,6 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{ //hook preload scene preload(): void { this.GameManager.setCurrentGameScene(this); - cypressAsserter.preloadStarted(); let mapUrl = 'maps/map.json'; this.load.on('filecomplete-tilemapJSON-'+Textures.Map, (key: string, type: string, data: any) => { // Triggered when the map is loaded @@ -69,8 +68,6 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{ }); this.load.bitmapFont('main_font', 'resources/fonts/arcade.png', 'resources/fonts/arcade.xml'); - - cypressAsserter.preloadFinished(); } //hook initialisation @@ -79,8 +76,6 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{ //hook create scene create(): void { - cypressAsserter.initStarted(); - //initalise map this.Map = this.add.tilemap("map"); this.map.tilesets.forEach((tileset: ITiledTileSet) => { @@ -120,7 +115,6 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{ //initialise camera this.initCamera(); - cypressAsserter.initFinished(); } //todo: in a dedicated class/function? @@ -182,7 +176,7 @@ export class GameScene extends Phaser.Scene implements GameSceneInterface{ this.createCollisionObject(); this.CurrentPlayer.on(hasMovedEventName, this.pushPlayerPosition.bind(this)) } - + pushPlayerPosition(event: HasMovedEvent) { this.GameManager.pushPlayerPosition(event); } diff --git a/front/src/Phaser/Login/LogincScene.ts b/front/src/Phaser/Login/LogincScene.ts index 3ed2f0f5..7aadfbc5 100644 --- a/front/src/Phaser/Login/LogincScene.ts +++ b/front/src/Phaser/Login/LogincScene.ts @@ -8,6 +8,7 @@ import {Player} from "../Player/Player"; import {getPlayerAnimations, PlayerAnimationNames} from "../Player/Animation"; import Rectangle = Phaser.GameObjects.Rectangle; import {PLAYER_RESOURCES} from "../Entity/PlayableCaracter"; +import {cypressAsserter} from "../../Cypress/CypressAsserter"; //todo: put this constants in a dedicated file export const LoginSceneName = "LoginScene"; @@ -36,10 +37,12 @@ export class LogincScene extends Phaser.Scene implements GameSceneInterface { } preload() { + cypressAsserter.preloadStarted(); //this.load.image(LoginTextures.playButton, "resources/objects/play_button.png"); this.load.image(LoginTextures.icon, "resources/logos/tcm_full.png"); // Note: arcade.png from the Phaser 3 examples at: https://github.com/photonstorm/phaser3-examples/tree/master/public/assets/fonts/bitmap this.load.bitmapFont(LoginTextures.mainFont, 'resources/fonts/arcade.png', 'resources/fonts/arcade.xml'); + cypressAsserter.preloadFinished(); //add player png PLAYER_RESOURCES.forEach((playerResource: any) => { this.load.spritesheet( @@ -51,6 +54,8 @@ export class LogincScene extends Phaser.Scene implements GameSceneInterface { } create() { + cypressAsserter.initStarted(); + this.textField = new TextField(this, this.game.renderer.width / 2, 50, 'Enter your name:'); this.textField.setOrigin(0.5).setCenterAlign() this.nameInput = new TextInput(this, this.game.renderer.width / 2 - 64, 70, 4); @@ -76,6 +81,7 @@ export class LogincScene extends Phaser.Scene implements GameSceneInterface { /*create user*/ this.createCurrentPlayer("test"); + cypressAsserter.initFinished(); } update(time: number, delta: number): void {