UNPKG

muttley

Version:
40 lines 1.05 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const level_view_1 = require("./level-view"); const initialLives = 3; class Player { constructor(player, position = [1, 1], lives = initialLives, direction = level_view_1.Direction.Left) { this._direction = level_view_1.Direction.Left; this.playerNumber = player; this._position = position; this._lives = lives; this._score = 10; // deliberate bug - should be 0 this._direction = direction; } get position() { return this._position; } get score() { return this._score; } get lives() { return this._lives; } get direction() { return this._direction; } moveTo(position) { this._position = position; } addToScore(points) { this._score += points; } loseLife() { this._lives--; } setDirection(direction) { this._direction = direction; } } exports.Player = Player; //# sourceMappingURL=player.js.map