UNPKG

@natewilcox/zelda-server

Version:

Server application for zelda multiplayer game

21 lines (20 loc) 612 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Player = void 0; class Player extends Phaser.Physics.Arcade.Sprite { constructor(scene, x, y, texture) { super(scene, x, y, texture); console.log(`player created at ${x}, ${y}.`); this.dir = new Phaser.Math.Vector2(); this.speed = 100; scene.add.existing(this); scene.physics.world.enable(this); } moveTowards(x, y) { this.scene.physics.moveTo(this, x, y, this.speed); } stopMoving() { this.setVelocity(0, 0); } } exports.Player = Player;