Bump Phaser version

This commit is contained in:
PizZaKatZe 2021-02-09 20:50:01 +01:00 committed by Thomas Basler
parent 353522e3cc
commit 9c8393c102
3 changed files with 10 additions and 12 deletions

View File

@ -1171,7 +1171,7 @@ ${escapedMessage}
this.Layers.push(Layer);
}
createInteractiveLayer(layer: ITiledMapLayer): InteractiveLayer {
createInteractiveLayer(layer: ITiledMapTileLayer): InteractiveLayer {
return new InteractiveLayer(this, layer);
}

View File

@ -5,7 +5,7 @@ import Container = Phaser.GameObjects.Container;
import type { GameScene } from "../Game/GameScene";
import type { Character } from "../Entity/Character";
import type { PositionInterface } from "../../Connexion/ConnexionModels";
import type { ITiledMapLayer, ITiledMapLayerProperty } from "./ITiledMap";
import type { ITiledMapTileLayer, ITiledMapLayerProperty } from "./ITiledMap";
interface SpriteEntity {
animation: string|false;
@ -26,12 +26,12 @@ interface TileAnimation {
export class InteractiveLayer extends Container {
private lastUpdate: number;
private allActive: boolean;
private layer: ITiledMapLayer;
private layer: ITiledMapTileLayer;
private spritesCollection: Array<SpriteEntity>;
private updateListener: Function;
constructor(scene: GameScene, layer: ITiledMapLayer) {
constructor(scene: GameScene, layer: ITiledMapTileLayer) {
const { x, y } = layer;
super(scene, x, y);
@ -159,9 +159,7 @@ export class InteractiveLayer extends Container {
const sprite = entity.sprite;
if (sprite.anims.isPlaying) {
sprite.anims.play(entity.animation, false, sprite.anims.currentFrame.index);
// This line needs to be changed to the following if you update to the new phaser version 3.54.0
// sprite.anims.play({ key: entity.animation, startFrame: sprite.anims.currentFrame.index }, false);
sprite.anims.play({ key: entity.animation, startFrame: sprite.anims.currentFrame.index }, false);
} else {
sprite.anims.play(entity.animation);
}
@ -192,10 +190,10 @@ export class InteractiveLayer extends Container {
* Adds all tiles from the layer as sprites to the scene. It will also define the
* animation frames, if they aren't already defined.
*
* @param {ITiledMapLayer} layer
* @param {ITiledMapTileLayer} layer
* @returns {void}
*/
private addSprites(layer: ITiledMapLayer): void {
private addSprites(layer: ITiledMapTileLayer): void {
if (typeof layer.data === "string") {
return;
}
@ -327,8 +325,8 @@ export class InteractiveLayer extends Container {
* @param {string} name
* @returns {string|boolean|number|undefined}
*/
private getLayerProperty(name: string): string|boolean|number|undefined {
const properties: ITiledMapLayerProperty[] = this.layer.properties;
private getLayerProperty(name: string): string | boolean | number | undefined {
const properties: ITiledMapLayerProperty[] | undefined = this.layer.properties;
if (!properties) {
return undefined;

View File

@ -2009,7 +2009,7 @@ eventemitter3@^3.1.2:
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-3.1.2.tgz#2d3d48f9c346698fce83a85d7d664e98535df6e7"
integrity sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==
eventemitter3@^4.0.0, eventemitter3@^4.0.3, eventemitter3@^4.0.4:
eventemitter3@^4.0.0, eventemitter3@^4.0.3, eventemitter3@^4.0.7:
version "4.0.7"
resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"
integrity sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==