sprites
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
import Phaser from "phaser";
|
||||
|
||||
export class Platform extends Phaser.GameObjects.Rectangle {
|
||||
static readonly COLOR = 0x4a7c3a;
|
||||
export class Platform extends Phaser.GameObjects.TileSprite {
|
||||
static readonly TEXTURE_KEY = "platform";
|
||||
|
||||
declare body: Phaser.Physics.Arcade.StaticBody;
|
||||
|
||||
constructor(scene: Phaser.Scene, x: number, y: number, width: number, height: number) {
|
||||
super(scene, x, y, width, height, Platform.COLOR);
|
||||
super(scene, x, y, width, height, Platform.TEXTURE_KEY);
|
||||
scene.add.existing(this);
|
||||
scene.physics.add.existing(this, true);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user