rewrote the app code to more easily allow for collisions

This commit is contained in:
kharhamel
2020-04-12 16:12:08 +02:00
parent 241cbd720a
commit 6e27377b07
10 changed files with 139 additions and 268 deletions
@@ -0,0 +1,16 @@
import {getPlayerAnimations, playAnimation, PlayerAnimationNames} from "../Player/Animation";
import {ActiveEventList, UserInputEvent} from "../UserInput/UserInputManager";
export class PlayableCaracter extends Phaser.Physics.Arcade.Sprite {
constructor(scene: Phaser.Scene, x: number, y: number, texture: string, frame?: string | number) {
super(scene, x, y, texture, frame);
scene.sys.updateList.add(this);
scene.sys.displayList.add(this);
this.setScale(2);
scene.physics.world.enableBody(this);
this.setImmovable(true);
this.setCollideWorldBounds(true)
}
}
+8
View File
@@ -0,0 +1,8 @@
export class Sprite extends Phaser.GameObjects.Sprite {
constructor(scene: Phaser.Scene, x: number, y: number, texture: string, frame?: number | string) {
super(scene, x, y, texture, frame);
scene.sys.updateList.add(this);
scene.sys.displayList.add(this);
}
}