mirror of
https://github.com/simon987/Much-Assembly-Required-Frontend.git
synced 2025-04-19 18:46:41 +00:00
Added support for vault worlds
This commit is contained in:
parent
c721ce97e1
commit
9c650c5387
65
mar/World.ts
65
mar/World.ts
@ -13,7 +13,9 @@ enum TileType {
|
|||||||
PLAIN,
|
PLAIN,
|
||||||
WALL,
|
WALL,
|
||||||
IRON,
|
IRON,
|
||||||
COPPER
|
COPPER,
|
||||||
|
VAULT_FLOOR,
|
||||||
|
VAULT_WALL,
|
||||||
}
|
}
|
||||||
|
|
||||||
class Tile extends Phaser.Plugin.Isometric.IsoSprite {
|
class Tile extends Phaser.Plugin.Isometric.IsoSprite {
|
||||||
@ -62,6 +64,12 @@ class Tile extends Phaser.Plugin.Isometric.IsoSprite {
|
|||||||
return new IronTile(x, y);
|
return new IronTile(x, y);
|
||||||
case TileType.COPPER:
|
case TileType.COPPER:
|
||||||
return new CopperTile(x, y);
|
return new CopperTile(x, y);
|
||||||
|
case TileType.VAULT_FLOOR:
|
||||||
|
return new VaultFloorTile(x, y);
|
||||||
|
case TileType.VAULT_WALL:
|
||||||
|
return new VaultWallTile(x, y);
|
||||||
|
case -1:
|
||||||
|
return new VoidTile(x, y);
|
||||||
case TileType.PLAIN:
|
case TileType.PLAIN:
|
||||||
default:
|
default:
|
||||||
return new PlainTile(x, y);
|
return new PlainTile(x, y);
|
||||||
@ -127,6 +135,49 @@ class WallTile extends Tile {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class VaultWallTile extends Tile {
|
||||||
|
|
||||||
|
constructor(x: number, y: number) {
|
||||||
|
super(x, y, config.wallSprite, 0.2);
|
||||||
|
|
||||||
|
this.baseTint = config.vaultWallTint;
|
||||||
|
this.tint = this.baseTint;
|
||||||
|
this.tileType = "vault wall";
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class VaultFloorTile extends Tile {
|
||||||
|
|
||||||
|
constructor(x: number, y: number) {
|
||||||
|
super(x, y, config.plainSprite, 0);
|
||||||
|
|
||||||
|
this.baseTint = config.vaultFloorTint;
|
||||||
|
this.tint = this.baseTint;
|
||||||
|
this.tileType = "vault floor";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class VoidTile extends Tile {
|
||||||
|
|
||||||
|
public onHover() {
|
||||||
|
mar.tileIndicator.tileX = this.tileX;
|
||||||
|
mar.tileIndicator.tileY = this.tileY;
|
||||||
|
mar.tileIndicator.tileType = this.tileType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public onExit() {
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(x: number, y: number) {
|
||||||
|
super(x, y, config.plainSprite, 0);
|
||||||
|
|
||||||
|
this.baseTint = config.vaultFloorTint;
|
||||||
|
this.tileType = "void";
|
||||||
|
this.alpha = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class IronTile extends Tile {
|
class IronTile extends Tile {
|
||||||
|
|
||||||
constructor(x: number, y: number) {
|
constructor(x: number, y: number) {
|
||||||
@ -173,13 +224,13 @@ class World {
|
|||||||
constructor(terrain, size) {
|
constructor(terrain, size) {
|
||||||
|
|
||||||
//Setup World Arrows
|
//Setup World Arrows
|
||||||
this.northArrow = new WorldArrow(528, -10, "ui/arrow_north", Direction.NORTH);
|
this.northArrow = new WorldArrow(528, -20, "ui/arrow_north", Direction.NORTH);
|
||||||
mar.isoGroup.add(this.northArrow);
|
mar.isoGroup.add(this.northArrow);
|
||||||
this.eastArrow = new WorldArrow(1115, 587, "ui/arrow_east", Direction.EAST);
|
this.eastArrow = new WorldArrow(1115, 587, "ui/arrow_east", Direction.EAST);
|
||||||
mar.isoGroup.add(this.eastArrow);
|
mar.isoGroup.add(this.eastArrow);
|
||||||
this.southArrow = new WorldArrow(0, 0, "ui/arrow_south", Direction.SOUTH);
|
this.southArrow = new WorldArrow(0, 0, "ui/arrow_south", Direction.SOUTH);
|
||||||
mar.isoGroup.add(this.southArrow);
|
mar.isoGroup.add(this.southArrow);
|
||||||
this.westArrow = new WorldArrow(-60, 587, "ui/arrow_west", Direction.WEST);
|
this.westArrow = new WorldArrow(-70, 587, "ui/arrow_west", Direction.WEST);
|
||||||
mar.isoGroup.add(this.westArrow);
|
mar.isoGroup.add(this.westArrow);
|
||||||
|
|
||||||
//Create tilemap
|
//Create tilemap
|
||||||
@ -208,12 +259,18 @@ class World {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Update World arrows location
|
//Update World arrows location
|
||||||
this.eastArrow.isoY = 32 * (size + 2);
|
|
||||||
this.eastArrow.isoX = 72.5 * (size) - 20;
|
this.eastArrow.isoX = 72.5 * (size) - 20;
|
||||||
|
this.eastArrow.isoY = 32 * (size + 2);
|
||||||
|
|
||||||
this.southArrow.isoX = 32 * (size + 1);
|
this.southArrow.isoX = 32 * (size + 1);
|
||||||
this.southArrow.isoY = 72.5 * (size) + 20;
|
this.southArrow.isoY = 72.5 * (size) + 20;
|
||||||
|
|
||||||
|
this.northArrow.isoX = 32 * (size + 1);
|
||||||
|
this.northArrow.isoY = -20;
|
||||||
|
|
||||||
|
this.westArrow.isoX = -70;
|
||||||
|
this.westArrow.isoY = 32 * (size + 2);
|
||||||
|
|
||||||
//Update Phaser World size
|
//Update Phaser World size
|
||||||
mar.game.world.width = (size + 2) * 128;
|
mar.game.world.width = (size + 2) * 128;
|
||||||
mar.game.world.height = (size + 2) * 64;
|
mar.game.world.height = (size + 2) * 64;
|
||||||
|
124
mar/app.js
124
mar/app.js
@ -8,7 +8,7 @@ var __extends = (this && this.__extends) || (function () {
|
|||||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||||
};
|
};
|
||||||
})();
|
})();
|
||||||
var MarGame = /** @class */ (function () {
|
var MarGame = (function () {
|
||||||
function MarGame() {
|
function MarGame() {
|
||||||
this.cursorPos = new Phaser.Plugin.Isometric.Point3();
|
this.cursorPos = new Phaser.Plugin.Isometric.Point3();
|
||||||
this.debugMessages = [];
|
this.debugMessages = [];
|
||||||
@ -220,7 +220,7 @@ var MarGame = /** @class */ (function () {
|
|||||||
};
|
};
|
||||||
return MarGame;
|
return MarGame;
|
||||||
}());
|
}());
|
||||||
var DebugMessage = /** @class */ (function () {
|
var DebugMessage = (function () {
|
||||||
function DebugMessage(x, y) {
|
function DebugMessage(x, y) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
@ -230,7 +230,7 @@ var DebugMessage = /** @class */ (function () {
|
|||||||
/**
|
/**
|
||||||
* Indicates hovered tile
|
* Indicates hovered tile
|
||||||
*/
|
*/
|
||||||
var TileIndicator = /** @class */ (function (_super) {
|
var TileIndicator = (function (_super) {
|
||||||
__extends(TileIndicator, _super);
|
__extends(TileIndicator, _super);
|
||||||
function TileIndicator() {
|
function TileIndicator() {
|
||||||
return _super !== null && _super.apply(this, arguments) || this;
|
return _super !== null && _super.apply(this, arguments) || this;
|
||||||
@ -248,7 +248,7 @@ var TileIndicator = /** @class */ (function (_super) {
|
|||||||
/**
|
/**
|
||||||
* Indicates current World
|
* Indicates current World
|
||||||
*/
|
*/
|
||||||
var WorldIndicator = /** @class */ (function (_super) {
|
var WorldIndicator = (function (_super) {
|
||||||
__extends(WorldIndicator, _super);
|
__extends(WorldIndicator, _super);
|
||||||
function WorldIndicator() {
|
function WorldIndicator() {
|
||||||
return _super !== null && _super.apply(this, arguments) || this;
|
return _super !== null && _super.apply(this, arguments) || this;
|
||||||
@ -271,6 +271,8 @@ var DEBUG = true;
|
|||||||
var config = {
|
var config = {
|
||||||
tileTint: 0xFFFFFF,
|
tileTint: 0xFFFFFF,
|
||||||
wallTint: 0xDDDDDD,
|
wallTint: 0xDDDDDD,
|
||||||
|
vaultWallTint: 0x3f1c1c,
|
||||||
|
vaultFloorTint: 0x3452C2A,
|
||||||
oreTint: 0xF3F3F3,
|
oreTint: 0xF3F3F3,
|
||||||
cubotHoverTint: 0x00FF00,
|
cubotHoverTint: 0x00FF00,
|
||||||
cubotTint: 0xFFFFFF,
|
cubotTint: 0xFFFFFF,
|
||||||
@ -316,7 +318,7 @@ var config = {
|
|||||||
otherCubotAlpha: 0.6,
|
otherCubotAlpha: 0.6,
|
||||||
defaultWorldSize: 16 //Will fallback to this when server does not provide world width
|
defaultWorldSize: 16 //Will fallback to this when server does not provide world width
|
||||||
};
|
};
|
||||||
var Util = /** @class */ (function () {
|
var Util = (function () {
|
||||||
function Util() {
|
function Util() {
|
||||||
}
|
}
|
||||||
//todo: find a more elegant way of doing this. Maybe this is related: https://github.com/lewster32/phaser-plugin-isometric/issues/7
|
//todo: find a more elegant way of doing this. Maybe this is related: https://github.com/lewster32/phaser-plugin-isometric/issues/7
|
||||||
@ -360,7 +362,7 @@ var Util = /** @class */ (function () {
|
|||||||
};
|
};
|
||||||
return Util;
|
return Util;
|
||||||
}());
|
}());
|
||||||
var Debug = /** @class */ (function () {
|
var Debug = (function () {
|
||||||
function Debug() {
|
function Debug() {
|
||||||
}
|
}
|
||||||
Debug.setTileAt = function (x, y, newTile) {
|
Debug.setTileAt = function (x, y, newTile) {
|
||||||
@ -414,7 +416,7 @@ var mar = new MarGame();
|
|||||||
/**
|
/**
|
||||||
* Client-side keyboard buffer. It is overwritten by the server at the end of tick.
|
* Client-side keyboard buffer. It is overwritten by the server at the end of tick.
|
||||||
*/
|
*/
|
||||||
var KeyboardBuffer = /** @class */ (function (_super) {
|
var KeyboardBuffer = (function (_super) {
|
||||||
__extends(KeyboardBuffer, _super);
|
__extends(KeyboardBuffer, _super);
|
||||||
function KeyboardBuffer() {
|
function KeyboardBuffer() {
|
||||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||||
@ -445,7 +447,7 @@ var KeyboardBuffer = /** @class */ (function (_super) {
|
|||||||
/**
|
/**
|
||||||
* Listens for object list
|
* Listens for object list
|
||||||
*/
|
*/
|
||||||
var ObjectsListener = /** @class */ (function () {
|
var ObjectsListener = (function () {
|
||||||
function ObjectsListener() {
|
function ObjectsListener() {
|
||||||
}
|
}
|
||||||
ObjectsListener.prototype.getListenedMessageType = function () {
|
ObjectsListener.prototype.getListenedMessageType = function () {
|
||||||
@ -461,7 +463,7 @@ var ObjectsListener = /** @class */ (function () {
|
|||||||
};
|
};
|
||||||
return ObjectsListener;
|
return ObjectsListener;
|
||||||
}());
|
}());
|
||||||
var TickListener = /** @class */ (function () {
|
var TickListener = (function () {
|
||||||
function TickListener() {
|
function TickListener() {
|
||||||
}
|
}
|
||||||
TickListener.prototype.getListenedMessageType = function () {
|
TickListener.prototype.getListenedMessageType = function () {
|
||||||
@ -483,7 +485,7 @@ var TickListener = /** @class */ (function () {
|
|||||||
};
|
};
|
||||||
return TickListener;
|
return TickListener;
|
||||||
}());
|
}());
|
||||||
var UserInfoListener = /** @class */ (function () {
|
var UserInfoListener = (function () {
|
||||||
function UserInfoListener() {
|
function UserInfoListener() {
|
||||||
}
|
}
|
||||||
UserInfoListener.prototype.getListenedMessageType = function () {
|
UserInfoListener.prototype.getListenedMessageType = function () {
|
||||||
@ -502,7 +504,7 @@ var UserInfoListener = /** @class */ (function () {
|
|||||||
};
|
};
|
||||||
return UserInfoListener;
|
return UserInfoListener;
|
||||||
}());
|
}());
|
||||||
var AuthListener = /** @class */ (function () {
|
var AuthListener = (function () {
|
||||||
function AuthListener() {
|
function AuthListener() {
|
||||||
}
|
}
|
||||||
AuthListener.prototype.getListenedMessageType = function () {
|
AuthListener.prototype.getListenedMessageType = function () {
|
||||||
@ -524,7 +526,7 @@ var AuthListener = /** @class */ (function () {
|
|||||||
};
|
};
|
||||||
return AuthListener;
|
return AuthListener;
|
||||||
}());
|
}());
|
||||||
var TerrainListener = /** @class */ (function () {
|
var TerrainListener = (function () {
|
||||||
function TerrainListener() {
|
function TerrainListener() {
|
||||||
}
|
}
|
||||||
TerrainListener.prototype.getListenedMessageType = function () {
|
TerrainListener.prototype.getListenedMessageType = function () {
|
||||||
@ -581,7 +583,7 @@ var TerrainListener = /** @class */ (function () {
|
|||||||
};
|
};
|
||||||
return TerrainListener;
|
return TerrainListener;
|
||||||
}());
|
}());
|
||||||
var CodeListener = /** @class */ (function () {
|
var CodeListener = (function () {
|
||||||
function CodeListener() {
|
function CodeListener() {
|
||||||
}
|
}
|
||||||
CodeListener.prototype.getListenedMessageType = function () {
|
CodeListener.prototype.getListenedMessageType = function () {
|
||||||
@ -592,7 +594,7 @@ var CodeListener = /** @class */ (function () {
|
|||||||
};
|
};
|
||||||
return CodeListener;
|
return CodeListener;
|
||||||
}());
|
}());
|
||||||
var CodeResponseListener = /** @class */ (function () {
|
var CodeResponseListener = (function () {
|
||||||
function CodeResponseListener() {
|
function CodeResponseListener() {
|
||||||
}
|
}
|
||||||
CodeResponseListener.prototype.getListenedMessageType = function () {
|
CodeResponseListener.prototype.getListenedMessageType = function () {
|
||||||
@ -603,7 +605,7 @@ var CodeResponseListener = /** @class */ (function () {
|
|||||||
};
|
};
|
||||||
return CodeResponseListener;
|
return CodeResponseListener;
|
||||||
}());
|
}());
|
||||||
var DebugResponseListener = /** @class */ (function () {
|
var DebugResponseListener = (function () {
|
||||||
function DebugResponseListener() {
|
function DebugResponseListener() {
|
||||||
}
|
}
|
||||||
DebugResponseListener.prototype.getListenedMessageType = function () {
|
DebugResponseListener.prototype.getListenedMessageType = function () {
|
||||||
@ -614,7 +616,7 @@ var DebugResponseListener = /** @class */ (function () {
|
|||||||
};
|
};
|
||||||
return DebugResponseListener;
|
return DebugResponseListener;
|
||||||
}());
|
}());
|
||||||
var GameClient = /** @class */ (function () {
|
var GameClient = (function () {
|
||||||
function GameClient() {
|
function GameClient() {
|
||||||
this.listeners = [];
|
this.listeners = [];
|
||||||
this.getServerInfo();
|
this.getServerInfo();
|
||||||
@ -822,7 +824,7 @@ var Action;
|
|||||||
Action[Action["LISTENING"] = 5] = "LISTENING";
|
Action[Action["LISTENING"] = 5] = "LISTENING";
|
||||||
Action[Action["JUMPING"] = 6] = "JUMPING";
|
Action[Action["JUMPING"] = 6] = "JUMPING";
|
||||||
})(Action || (Action = {}));
|
})(Action || (Action = {}));
|
||||||
var GameObject = /** @class */ (function (_super) {
|
var GameObject = (function (_super) {
|
||||||
__extends(GameObject, _super);
|
__extends(GameObject, _super);
|
||||||
function GameObject(x, y, z, key, frame) {
|
function GameObject(x, y, z, key, frame) {
|
||||||
return _super.call(this, mar.game, x, y, z, key, frame) || this;
|
return _super.call(this, mar.game, x, y, z, key, frame) || this;
|
||||||
@ -877,7 +879,7 @@ var HologramMode;
|
|||||||
HologramMode[HologramMode["STRING"] = 2] = "STRING";
|
HologramMode[HologramMode["STRING"] = 2] = "STRING";
|
||||||
HologramMode[HologramMode["DEC"] = 3] = "DEC";
|
HologramMode[HologramMode["DEC"] = 3] = "DEC";
|
||||||
})(HologramMode || (HologramMode = {}));
|
})(HologramMode || (HologramMode = {}));
|
||||||
var Cubot = /** @class */ (function (_super) {
|
var Cubot = (function (_super) {
|
||||||
__extends(Cubot, _super);
|
__extends(Cubot, _super);
|
||||||
function Cubot(json) {
|
function Cubot(json) {
|
||||||
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", null) || this;
|
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", null) || this;
|
||||||
@ -1133,7 +1135,7 @@ var Cubot = /** @class */ (function (_super) {
|
|||||||
};
|
};
|
||||||
return Cubot;
|
return Cubot;
|
||||||
}(GameObject));
|
}(GameObject));
|
||||||
var HarvesterNPC = /** @class */ (function (_super) {
|
var HarvesterNPC = (function (_super) {
|
||||||
__extends(HarvesterNPC, _super);
|
__extends(HarvesterNPC, _super);
|
||||||
function HarvesterNPC(json) {
|
function HarvesterNPC(json) {
|
||||||
var _this = _super.call(this, json) || this;
|
var _this = _super.call(this, json) || this;
|
||||||
@ -1193,7 +1195,7 @@ var HarvesterNPC = /** @class */ (function (_super) {
|
|||||||
};
|
};
|
||||||
return HarvesterNPC;
|
return HarvesterNPC;
|
||||||
}(Cubot));
|
}(Cubot));
|
||||||
var BiomassBlob = /** @class */ (function (_super) {
|
var BiomassBlob = (function (_super) {
|
||||||
__extends(BiomassBlob, _super);
|
__extends(BiomassBlob, _super);
|
||||||
function BiomassBlob(json) {
|
function BiomassBlob(json) {
|
||||||
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 10, "sheet", 1) || this;
|
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 10, "sheet", 1) || this;
|
||||||
@ -1232,7 +1234,7 @@ var BiomassBlob = /** @class */ (function (_super) {
|
|||||||
};
|
};
|
||||||
return BiomassBlob;
|
return BiomassBlob;
|
||||||
}(GameObject));
|
}(GameObject));
|
||||||
var Factory = /** @class */ (function (_super) {
|
var Factory = (function (_super) {
|
||||||
__extends(Factory, _super);
|
__extends(Factory, _super);
|
||||||
function Factory(json) {
|
function Factory(json) {
|
||||||
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/factory") || this;
|
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/factory") || this;
|
||||||
@ -1268,7 +1270,7 @@ var Factory = /** @class */ (function (_super) {
|
|||||||
;
|
;
|
||||||
return Factory;
|
return Factory;
|
||||||
}(GameObject));
|
}(GameObject));
|
||||||
var RadioTower = /** @class */ (function (_super) {
|
var RadioTower = (function (_super) {
|
||||||
__extends(RadioTower, _super);
|
__extends(RadioTower, _super);
|
||||||
function RadioTower(json) {
|
function RadioTower(json) {
|
||||||
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/RadioTower") || this;
|
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/RadioTower") || this;
|
||||||
@ -1299,7 +1301,7 @@ var RadioTower = /** @class */ (function (_super) {
|
|||||||
};
|
};
|
||||||
return RadioTower;
|
return RadioTower;
|
||||||
}(GameObject));
|
}(GameObject));
|
||||||
var VaultDoor = /** @class */ (function (_super) {
|
var VaultDoor = (function (_super) {
|
||||||
__extends(VaultDoor, _super);
|
__extends(VaultDoor, _super);
|
||||||
function VaultDoor(json) {
|
function VaultDoor(json) {
|
||||||
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/biomass/idle/0001") || this;
|
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/biomass/idle/0001") || this;
|
||||||
@ -1346,8 +1348,10 @@ var TileType;
|
|||||||
TileType[TileType["WALL"] = 1] = "WALL";
|
TileType[TileType["WALL"] = 1] = "WALL";
|
||||||
TileType[TileType["IRON"] = 2] = "IRON";
|
TileType[TileType["IRON"] = 2] = "IRON";
|
||||||
TileType[TileType["COPPER"] = 3] = "COPPER";
|
TileType[TileType["COPPER"] = 3] = "COPPER";
|
||||||
|
TileType[TileType["VAULT_FLOOR"] = 4] = "VAULT_FLOOR";
|
||||||
|
TileType[TileType["VAULT_WALL"] = 5] = "VAULT_WALL";
|
||||||
})(TileType || (TileType = {}));
|
})(TileType || (TileType = {}));
|
||||||
var Tile = /** @class */ (function (_super) {
|
var Tile = (function (_super) {
|
||||||
__extends(Tile, _super);
|
__extends(Tile, _super);
|
||||||
function Tile(x, y, sprite, anchorY) {
|
function Tile(x, y, sprite, anchorY) {
|
||||||
var _this = _super.call(this, mar.game, Util.getIsoX(x), Util.getIsoY(y), 0, 'sheet', sprite) || this;
|
var _this = _super.call(this, mar.game, Util.getIsoX(x), Util.getIsoY(y), 0, 'sheet', sprite) || this;
|
||||||
@ -1368,6 +1372,12 @@ var Tile = /** @class */ (function (_super) {
|
|||||||
return new IronTile(x, y);
|
return new IronTile(x, y);
|
||||||
case TileType.COPPER:
|
case TileType.COPPER:
|
||||||
return new CopperTile(x, y);
|
return new CopperTile(x, y);
|
||||||
|
case TileType.VAULT_FLOOR:
|
||||||
|
return new VaultFloorTile(x, y);
|
||||||
|
case TileType.VAULT_WALL:
|
||||||
|
return new VaultWallTile(x, y);
|
||||||
|
case -1:
|
||||||
|
return new VoidTile(x, y);
|
||||||
case TileType.PLAIN:
|
case TileType.PLAIN:
|
||||||
default:
|
default:
|
||||||
return new PlainTile(x, y);
|
return new PlainTile(x, y);
|
||||||
@ -1402,7 +1412,7 @@ var Tile = /** @class */ (function (_super) {
|
|||||||
};
|
};
|
||||||
return Tile;
|
return Tile;
|
||||||
}(Phaser.Plugin.Isometric.IsoSprite));
|
}(Phaser.Plugin.Isometric.IsoSprite));
|
||||||
var PlainTile = /** @class */ (function (_super) {
|
var PlainTile = (function (_super) {
|
||||||
__extends(PlainTile, _super);
|
__extends(PlainTile, _super);
|
||||||
function PlainTile(x, y) {
|
function PlainTile(x, y) {
|
||||||
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
||||||
@ -1413,7 +1423,7 @@ var PlainTile = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
return PlainTile;
|
return PlainTile;
|
||||||
}(Tile));
|
}(Tile));
|
||||||
var WallTile = /** @class */ (function (_super) {
|
var WallTile = (function (_super) {
|
||||||
__extends(WallTile, _super);
|
__extends(WallTile, _super);
|
||||||
function WallTile(x, y) {
|
function WallTile(x, y) {
|
||||||
var _this = _super.call(this, x, y, config.wallSprite, 0.2) || this;
|
var _this = _super.call(this, x, y, config.wallSprite, 0.2) || this;
|
||||||
@ -1424,7 +1434,47 @@ var WallTile = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
return WallTile;
|
return WallTile;
|
||||||
}(Tile));
|
}(Tile));
|
||||||
var IronTile = /** @class */ (function (_super) {
|
var VaultWallTile = (function (_super) {
|
||||||
|
__extends(VaultWallTile, _super);
|
||||||
|
function VaultWallTile(x, y) {
|
||||||
|
var _this = _super.call(this, x, y, config.wallSprite, 0.2) || this;
|
||||||
|
_this.baseTint = config.vaultWallTint;
|
||||||
|
_this.tint = _this.baseTint;
|
||||||
|
_this.tileType = "vault wall";
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
return VaultWallTile;
|
||||||
|
}(Tile));
|
||||||
|
var VaultFloorTile = (function (_super) {
|
||||||
|
__extends(VaultFloorTile, _super);
|
||||||
|
function VaultFloorTile(x, y) {
|
||||||
|
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
||||||
|
_this.baseTint = config.vaultFloorTint;
|
||||||
|
_this.tint = _this.baseTint;
|
||||||
|
_this.tileType = "vault floor";
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
return VaultFloorTile;
|
||||||
|
}(Tile));
|
||||||
|
var VoidTile = (function (_super) {
|
||||||
|
__extends(VoidTile, _super);
|
||||||
|
function VoidTile(x, y) {
|
||||||
|
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
||||||
|
_this.baseTint = config.vaultFloorTint;
|
||||||
|
_this.tileType = "void";
|
||||||
|
_this.alpha = 0;
|
||||||
|
return _this;
|
||||||
|
}
|
||||||
|
VoidTile.prototype.onHover = function () {
|
||||||
|
mar.tileIndicator.tileX = this.tileX;
|
||||||
|
mar.tileIndicator.tileY = this.tileY;
|
||||||
|
mar.tileIndicator.tileType = this.tileType;
|
||||||
|
};
|
||||||
|
VoidTile.prototype.onExit = function () {
|
||||||
|
};
|
||||||
|
return VoidTile;
|
||||||
|
}(Tile));
|
||||||
|
var IronTile = (function (_super) {
|
||||||
__extends(IronTile, _super);
|
__extends(IronTile, _super);
|
||||||
function IronTile(x, y) {
|
function IronTile(x, y) {
|
||||||
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
||||||
@ -1436,7 +1486,7 @@ var IronTile = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
return IronTile;
|
return IronTile;
|
||||||
}(Tile));
|
}(Tile));
|
||||||
var CopperTile = /** @class */ (function (_super) {
|
var CopperTile = (function (_super) {
|
||||||
__extends(CopperTile, _super);
|
__extends(CopperTile, _super);
|
||||||
function CopperTile(x, y) {
|
function CopperTile(x, y) {
|
||||||
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
||||||
@ -1448,18 +1498,18 @@ var CopperTile = /** @class */ (function (_super) {
|
|||||||
}
|
}
|
||||||
return CopperTile;
|
return CopperTile;
|
||||||
}(Tile));
|
}(Tile));
|
||||||
var World = /** @class */ (function () {
|
var World = (function () {
|
||||||
function World(terrain, size) {
|
function World(terrain, size) {
|
||||||
this.tiles = [];
|
this.tiles = [];
|
||||||
this.objects = [];
|
this.objects = [];
|
||||||
//Setup World Arrows
|
//Setup World Arrows
|
||||||
this.northArrow = new WorldArrow(528, -10, "ui/arrow_north", Direction.NORTH);
|
this.northArrow = new WorldArrow(528, -20, "ui/arrow_north", Direction.NORTH);
|
||||||
mar.isoGroup.add(this.northArrow);
|
mar.isoGroup.add(this.northArrow);
|
||||||
this.eastArrow = new WorldArrow(1115, 587, "ui/arrow_east", Direction.EAST);
|
this.eastArrow = new WorldArrow(1115, 587, "ui/arrow_east", Direction.EAST);
|
||||||
mar.isoGroup.add(this.eastArrow);
|
mar.isoGroup.add(this.eastArrow);
|
||||||
this.southArrow = new WorldArrow(0, 0, "ui/arrow_south", Direction.SOUTH);
|
this.southArrow = new WorldArrow(0, 0, "ui/arrow_south", Direction.SOUTH);
|
||||||
mar.isoGroup.add(this.southArrow);
|
mar.isoGroup.add(this.southArrow);
|
||||||
this.westArrow = new WorldArrow(-60, 587, "ui/arrow_west", Direction.WEST);
|
this.westArrow = new WorldArrow(-70, 587, "ui/arrow_west", Direction.WEST);
|
||||||
mar.isoGroup.add(this.westArrow);
|
mar.isoGroup.add(this.westArrow);
|
||||||
//Create tilemap
|
//Create tilemap
|
||||||
this.setTerrain(terrain, size);
|
this.setTerrain(terrain, size);
|
||||||
@ -1481,10 +1531,14 @@ var World = /** @class */ (function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//Update World arrows location
|
//Update World arrows location
|
||||||
this.eastArrow.isoY = 32 * (size + 2);
|
|
||||||
this.eastArrow.isoX = 72.5 * (size) - 20;
|
this.eastArrow.isoX = 72.5 * (size) - 20;
|
||||||
|
this.eastArrow.isoY = 32 * (size + 2);
|
||||||
this.southArrow.isoX = 32 * (size + 1);
|
this.southArrow.isoX = 32 * (size + 1);
|
||||||
this.southArrow.isoY = 72.5 * (size) + 20;
|
this.southArrow.isoY = 72.5 * (size) + 20;
|
||||||
|
this.northArrow.isoX = 32 * (size + 1);
|
||||||
|
this.northArrow.isoY = -20;
|
||||||
|
this.westArrow.isoX = -70;
|
||||||
|
this.westArrow.isoY = 32 * (size + 2);
|
||||||
//Update Phaser World size
|
//Update Phaser World size
|
||||||
mar.game.world.width = (size + 2) * 128;
|
mar.game.world.width = (size + 2) * 128;
|
||||||
mar.game.world.height = (size + 2) * 64;
|
mar.game.world.height = (size + 2) * 64;
|
||||||
@ -1588,7 +1642,7 @@ var World = /** @class */ (function () {
|
|||||||
/**
|
/**
|
||||||
* Represents a 'button' sprite that changes world in a direction
|
* Represents a 'button' sprite that changes world in a direction
|
||||||
*/
|
*/
|
||||||
var WorldArrow = /** @class */ (function (_super) {
|
var WorldArrow = (function (_super) {
|
||||||
__extends(WorldArrow, _super);
|
__extends(WorldArrow, _super);
|
||||||
function WorldArrow(x, y, frame, direction) {
|
function WorldArrow(x, y, frame, direction) {
|
||||||
var _this = _super.call(this, mar.game, x, y, 10, "sheet", frame) || this;
|
var _this = _super.call(this, mar.game, x, y, 10, "sheet", frame) || this;
|
||||||
@ -1636,14 +1690,14 @@ var ConsoleMode;
|
|||||||
ConsoleMode[ConsoleMode["CLEAR"] = 0] = "CLEAR";
|
ConsoleMode[ConsoleMode["CLEAR"] = 0] = "CLEAR";
|
||||||
ConsoleMode[ConsoleMode["NORMAL"] = 1] = "NORMAL";
|
ConsoleMode[ConsoleMode["NORMAL"] = 1] = "NORMAL";
|
||||||
})(ConsoleMode || (ConsoleMode = {}));
|
})(ConsoleMode || (ConsoleMode = {}));
|
||||||
var PlainTextConsoleMode = /** @class */ (function () {
|
var PlainTextConsoleMode = (function () {
|
||||||
function PlainTextConsoleMode(lineWidth, dialImage) {
|
function PlainTextConsoleMode(lineWidth, dialImage) {
|
||||||
this.width = lineWidth;
|
this.width = lineWidth;
|
||||||
this.dialImage = dialImage;
|
this.dialImage = dialImage;
|
||||||
}
|
}
|
||||||
return PlainTextConsoleMode;
|
return PlainTextConsoleMode;
|
||||||
}());
|
}());
|
||||||
var PlainTextConsole = /** @class */ (function () {
|
var PlainTextConsole = (function () {
|
||||||
function PlainTextConsole(text, id, colorId, scrollId, resetID, dialId) {
|
function PlainTextConsole(text, id, colorId, scrollId, resetID, dialId) {
|
||||||
this.colorToggled = false;
|
this.colorToggled = false;
|
||||||
this.autoScroll = true;
|
this.autoScroll = true;
|
||||||
|
@ -8,6 +8,8 @@ let DEBUG: boolean = true;
|
|||||||
let config = {
|
let config = {
|
||||||
tileTint: 0xFFFFFF,
|
tileTint: 0xFFFFFF,
|
||||||
wallTint: 0xDDDDDD,
|
wallTint: 0xDDDDDD,
|
||||||
|
vaultWallTint: 0x3f1c1c,
|
||||||
|
vaultFloorTint: 0x3452C2A,
|
||||||
oreTint: 0xF3F3F3,
|
oreTint: 0xF3F3F3,
|
||||||
cubotHoverTint: 0x00FF00,
|
cubotHoverTint: 0x00FF00,
|
||||||
cubotTint: 0xFFFFFF,
|
cubotTint: 0xFFFFFF,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user