mirror of
https://github.com/simon987/Much-Assembly-Required-Frontend.git
synced 2025-04-10 14:26:44 +00:00
Basic Vault Door Support
This commit is contained in:
parent
5d36a55f2d
commit
8119ababb2
@ -3,7 +3,8 @@ enum ObjectType {
|
||||
BIOMASS = 2,
|
||||
HARVESTER_NPC = 10,
|
||||
FACTORY = 3,
|
||||
RADIO_TOWER = 4
|
||||
RADIO_TOWER = 4,
|
||||
VAULT_DOOR = 5,
|
||||
}
|
||||
|
||||
enum ItemType {
|
||||
@ -62,6 +63,8 @@ abstract class GameObject extends Phaser.Plugin.Isometric.IsoSprite {
|
||||
return new Factory(json);
|
||||
case ObjectType.RADIO_TOWER:
|
||||
return new RadioTower(json);
|
||||
case ObjectType.VAULT_DOOR:
|
||||
return new VaultDoor(json);
|
||||
|
||||
default:
|
||||
return null;
|
||||
@ -556,7 +559,7 @@ class RadioTower extends GameObject {
|
||||
constructor(json) {
|
||||
super(Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/RadioTower");
|
||||
|
||||
this.anchor.set(0.5, 0.64);
|
||||
this.anchor.set(0.48, 0.65);
|
||||
this.setText("Radio Tower");
|
||||
this.text.visible = false;
|
||||
|
||||
@ -564,4 +567,43 @@ class RadioTower extends GameObject {
|
||||
this.tileX = json.x;
|
||||
this.tileY = json.y;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class VaultDoor extends GameObject {
|
||||
|
||||
public onTileHover() {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 25}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1.06, y: 1.06}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotHoverTint;
|
||||
|
||||
this.text.visible = true;
|
||||
}
|
||||
|
||||
public onTileExit() {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 15}, 400, Phaser.Easing.Bounce.Out, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1, y: 1}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotTint;
|
||||
|
||||
this.text.visible = false;
|
||||
}
|
||||
|
||||
public updateObject(json) {
|
||||
//No op
|
||||
}
|
||||
|
||||
constructor(json) {
|
||||
super(Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/VaultDoor");
|
||||
|
||||
this.anchor.set(myVarX, myVarY);
|
||||
this.setText("Vault");
|
||||
this.text.visible = false;
|
||||
|
||||
this.id = json.i;
|
||||
this.tileX = json.x;
|
||||
this.tileY = json.y;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
85
mar/app.js
85
mar/app.js
@ -12,7 +12,6 @@ var __extends = (this && this.__extends) || (function () {
|
||||
function __() {
|
||||
this.constructor = d;
|
||||
}
|
||||
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
@ -123,7 +122,6 @@ var MarGame = /** @class */ (function () {
|
||||
this.game.state.add('Boot', this.bootState);
|
||||
this.game.state.start('Boot');
|
||||
}
|
||||
|
||||
MarGame.prototype.addDebugMessage = function (debugMsg) {
|
||||
this.debugMessages.push(debugMsg);
|
||||
};
|
||||
@ -233,7 +231,6 @@ var DebugMessage = /** @class */ (function () {
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
}
|
||||
|
||||
return DebugMessage;
|
||||
}());
|
||||
/**
|
||||
@ -241,11 +238,9 @@ var DebugMessage = /** @class */ (function () {
|
||||
*/
|
||||
var TileIndicator = /** @class */ (function (_super) {
|
||||
__extends(TileIndicator, _super);
|
||||
|
||||
function TileIndicator() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
|
||||
TileIndicator.prototype.getMessage = function () {
|
||||
if (this.tileType != undefined) {
|
||||
return this.tileX + ", " + this.tileY + " : " + this.tileType;
|
||||
@ -261,11 +256,9 @@ var TileIndicator = /** @class */ (function (_super) {
|
||||
*/
|
||||
var WorldIndicator = /** @class */ (function (_super) {
|
||||
__extends(WorldIndicator, _super);
|
||||
|
||||
function WorldIndicator() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
|
||||
WorldIndicator.prototype.getMessage = function () {
|
||||
if (mar.world != undefined) {
|
||||
return "World: (" + Number(mar.client.worldX).toString(16).toUpperCase() + ", " +
|
||||
@ -332,7 +325,6 @@ var config = {
|
||||
var Util = /** @class */ (function () {
|
||||
function Util() {
|
||||
}
|
||||
|
||||
//todo: find a more elegant way of doing this. Maybe this is related: https://github.com/lewster32/phaser-plugin-isometric/issues/7
|
||||
Util.getIsoY = function (y) {
|
||||
return Util.getIsoX(y);
|
||||
@ -365,12 +357,13 @@ var Util = /** @class */ (function () {
|
||||
return Util;
|
||||
}());
|
||||
var mar = new MarGame();
|
||||
var myVarX = 0.46;
|
||||
var myVarY = 0.46;
|
||||
/**
|
||||
* Client-side keyboard buffer. It is overwritten by the server at the end of tick.
|
||||
*/
|
||||
var KeyboardBuffer = /** @class */ (function (_super) {
|
||||
__extends(KeyboardBuffer, _super);
|
||||
|
||||
function KeyboardBuffer() {
|
||||
var _this = _super !== null && _super.apply(this, arguments) || this;
|
||||
/**
|
||||
@ -380,7 +373,6 @@ var KeyboardBuffer = /** @class */ (function (_super) {
|
||||
_this.keys = [];
|
||||
return _this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string} Message written on the screen
|
||||
*/
|
||||
@ -404,7 +396,6 @@ var KeyboardBuffer = /** @class */ (function (_super) {
|
||||
var ObjectsListener = /** @class */ (function () {
|
||||
function ObjectsListener() {
|
||||
}
|
||||
|
||||
ObjectsListener.prototype.getListenedMessageType = function () {
|
||||
return "object";
|
||||
};
|
||||
@ -421,7 +412,6 @@ var ObjectsListener = /** @class */ (function () {
|
||||
var TickListener = /** @class */ (function () {
|
||||
function TickListener() {
|
||||
}
|
||||
|
||||
TickListener.prototype.getListenedMessageType = function () {
|
||||
return "tick";
|
||||
};
|
||||
@ -444,7 +434,6 @@ var TickListener = /** @class */ (function () {
|
||||
var UserInfoListener = /** @class */ (function () {
|
||||
function UserInfoListener() {
|
||||
}
|
||||
|
||||
UserInfoListener.prototype.getListenedMessageType = function () {
|
||||
return "userInfo";
|
||||
};
|
||||
@ -463,7 +452,6 @@ var UserInfoListener = /** @class */ (function () {
|
||||
var AuthListener = /** @class */ (function () {
|
||||
function AuthListener() {
|
||||
}
|
||||
|
||||
AuthListener.prototype.getListenedMessageType = function () {
|
||||
return "auth";
|
||||
};
|
||||
@ -486,7 +474,6 @@ var AuthListener = /** @class */ (function () {
|
||||
var TerrainListener = /** @class */ (function () {
|
||||
function TerrainListener() {
|
||||
}
|
||||
|
||||
TerrainListener.prototype.getListenedMessageType = function () {
|
||||
return "terrain";
|
||||
};
|
||||
@ -544,7 +531,6 @@ var TerrainListener = /** @class */ (function () {
|
||||
var CodeListener = /** @class */ (function () {
|
||||
function CodeListener() {
|
||||
}
|
||||
|
||||
CodeListener.prototype.getListenedMessageType = function () {
|
||||
return "code";
|
||||
};
|
||||
@ -556,7 +542,6 @@ var CodeListener = /** @class */ (function () {
|
||||
var CodeResponseListener = /** @class */ (function () {
|
||||
function CodeResponseListener() {
|
||||
}
|
||||
|
||||
CodeResponseListener.prototype.getListenedMessageType = function () {
|
||||
return "codeResponse";
|
||||
};
|
||||
@ -571,7 +556,6 @@ var GameClient = /** @class */ (function () {
|
||||
this.getServerInfo();
|
||||
this.consoleScreen = new PlainTextConsole(defaultText, "consoleText", "colorButton", "scrollButton", "resetButton", "widthDial");
|
||||
}
|
||||
|
||||
GameClient.prototype.requestUserInfo = function () {
|
||||
if (DEBUG) {
|
||||
console.log("[MAR] Requesting user info");
|
||||
@ -752,6 +736,7 @@ var ObjectType;
|
||||
ObjectType[ObjectType["HARVESTER_NPC"] = 10] = "HARVESTER_NPC";
|
||||
ObjectType[ObjectType["FACTORY"] = 3] = "FACTORY";
|
||||
ObjectType[ObjectType["RADIO_TOWER"] = 4] = "RADIO_TOWER";
|
||||
ObjectType[ObjectType["VAULT_DOOR"] = 5] = "VAULT_DOOR";
|
||||
})(ObjectType || (ObjectType = {}));
|
||||
var ItemType;
|
||||
(function (ItemType) {
|
||||
@ -771,11 +756,9 @@ var Action;
|
||||
})(Action || (Action = {}));
|
||||
var GameObject = /** @class */ (function (_super) {
|
||||
__extends(GameObject, _super);
|
||||
|
||||
function GameObject(x, y, z, key, frame) {
|
||||
return _super.call(this, mar.game, x, y, z, key, frame) || this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method for GameObjects
|
||||
*/
|
||||
@ -791,6 +774,8 @@ var GameObject = /** @class */ (function (_super) {
|
||||
return new Factory(json);
|
||||
case ObjectType.RADIO_TOWER:
|
||||
return new RadioTower(json);
|
||||
case ObjectType.VAULT_DOOR:
|
||||
return new VaultDoor(json);
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@ -826,7 +811,6 @@ var HologramMode;
|
||||
})(HologramMode || (HologramMode = {}));
|
||||
var Cubot = /** @class */ (function (_super) {
|
||||
__extends(Cubot, _super);
|
||||
|
||||
function Cubot(json) {
|
||||
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", null) || this;
|
||||
/**
|
||||
@ -859,7 +843,6 @@ var Cubot = /** @class */ (function (_super) {
|
||||
_this.tint = _this.getTint();
|
||||
return _this;
|
||||
}
|
||||
|
||||
Cubot.prototype.onTileHover = function () {
|
||||
mar.game.add.tween(this).to({isoZ: 45}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1.2, y: 1.2}, 200, Phaser.Easing.Linear.None, true);
|
||||
@ -1042,7 +1025,6 @@ var Cubot = /** @class */ (function (_super) {
|
||||
}(GameObject));
|
||||
var HarvesterNPC = /** @class */ (function (_super) {
|
||||
__extends(HarvesterNPC, _super);
|
||||
|
||||
function HarvesterNPC(json) {
|
||||
var _this = _super.call(this, json) || this;
|
||||
//Overwrite Cubot's animations
|
||||
@ -1055,7 +1037,6 @@ var HarvesterNPC = /** @class */ (function (_super) {
|
||||
_this.text.visible = false;
|
||||
return _this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Needs to be overridden because Cubot() calls getTint() when initialised
|
||||
*/
|
||||
@ -1104,7 +1085,6 @@ var HarvesterNPC = /** @class */ (function (_super) {
|
||||
}(Cubot));
|
||||
var BiomassBlob = /** @class */ (function (_super) {
|
||||
__extends(BiomassBlob, _super);
|
||||
|
||||
function BiomassBlob(json) {
|
||||
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 10, "sheet", 1) || this;
|
||||
if (DEBUG) {
|
||||
@ -1121,7 +1101,6 @@ var BiomassBlob = /** @class */ (function (_super) {
|
||||
_this.text.visible = false;
|
||||
return _this;
|
||||
}
|
||||
|
||||
BiomassBlob.prototype.onTileHover = function () {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 45}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
@ -1145,7 +1124,6 @@ var BiomassBlob = /** @class */ (function (_super) {
|
||||
}(GameObject));
|
||||
var Factory = /** @class */ (function (_super) {
|
||||
__extends(Factory, _super);
|
||||
|
||||
function Factory(json) {
|
||||
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/factory") || this;
|
||||
_this.anchor.set(0.5, .25);
|
||||
@ -1156,7 +1134,6 @@ var Factory = /** @class */ (function (_super) {
|
||||
_this.tileY = json.y;
|
||||
return _this;
|
||||
}
|
||||
|
||||
Factory.prototype.onTileHover = function () {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 25}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
@ -1183,10 +1160,9 @@ var Factory = /** @class */ (function (_super) {
|
||||
}(GameObject));
|
||||
var RadioTower = /** @class */ (function (_super) {
|
||||
__extends(RadioTower, _super);
|
||||
|
||||
function RadioTower(json) {
|
||||
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/RadioTower") || this;
|
||||
_this.anchor.set(0.5, 0.64);
|
||||
_this.anchor.set(0.48, 0.65);
|
||||
_this.setText("Radio Tower");
|
||||
_this.text.visible = false;
|
||||
_this.id = json.i;
|
||||
@ -1194,7 +1170,6 @@ var RadioTower = /** @class */ (function (_super) {
|
||||
_this.tileY = json.y;
|
||||
return _this;
|
||||
}
|
||||
|
||||
RadioTower.prototype.onTileHover = function () {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 25}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
@ -1214,6 +1189,39 @@ var RadioTower = /** @class */ (function (_super) {
|
||||
};
|
||||
return RadioTower;
|
||||
}(GameObject));
|
||||
var VaultDoor = /** @class */ (function (_super) {
|
||||
__extends(VaultDoor, _super);
|
||||
|
||||
function VaultDoor(json) {
|
||||
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/VaultDoor") || this;
|
||||
_this.anchor.set(myVarX, myVarY);
|
||||
_this.setText("Vault");
|
||||
_this.text.visible = false;
|
||||
_this.id = json.i;
|
||||
_this.tileX = json.x;
|
||||
_this.tileY = json.y;
|
||||
return _this;
|
||||
}
|
||||
|
||||
VaultDoor.prototype.onTileHover = function () {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 25}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1.06, y: 1.06}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotHoverTint;
|
||||
this.text.visible = true;
|
||||
};
|
||||
VaultDoor.prototype.onTileExit = function () {
|
||||
mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ: 15}, 400, Phaser.Easing.Bounce.Out, true);
|
||||
mar.game.add.tween(this.scale).to({x: 1, y: 1}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = config.cubotTint;
|
||||
this.text.visible = false;
|
||||
};
|
||||
VaultDoor.prototype.updateObject = function (json) {
|
||||
//No op
|
||||
};
|
||||
return VaultDoor;
|
||||
}(GameObject));
|
||||
///<reference path="phaser.d.ts"/>
|
||||
///<reference path="phaser.plugin.isometric.d.ts"/>
|
||||
var Direction;
|
||||
@ -1232,7 +1240,6 @@ var TileType;
|
||||
})(TileType || (TileType = {}));
|
||||
var Tile = /** @class */ (function (_super) {
|
||||
__extends(Tile, _super);
|
||||
|
||||
function Tile(x, y, sprite, anchorY) {
|
||||
var _this = _super.call(this, mar.game, Util.getIsoX(x), Util.getIsoY(y), 0, 'sheet', sprite) || this;
|
||||
_this.baseZ = 0; //Base height of the tile
|
||||
@ -1241,7 +1248,6 @@ var Tile = /** @class */ (function (_super) {
|
||||
_this.anchor.set(0.5, anchorY);
|
||||
return _this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method to create a Tile
|
||||
*/
|
||||
@ -1289,7 +1295,6 @@ var Tile = /** @class */ (function (_super) {
|
||||
}(Phaser.Plugin.Isometric.IsoSprite));
|
||||
var PlainTile = /** @class */ (function (_super) {
|
||||
__extends(PlainTile, _super);
|
||||
|
||||
function PlainTile(x, y) {
|
||||
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
||||
_this.baseTint = config.tileTint;
|
||||
@ -1297,12 +1302,10 @@ var PlainTile = /** @class */ (function (_super) {
|
||||
_this.tileType = "plain";
|
||||
return _this;
|
||||
}
|
||||
|
||||
return PlainTile;
|
||||
}(Tile));
|
||||
var WallTile = /** @class */ (function (_super) {
|
||||
__extends(WallTile, _super);
|
||||
|
||||
function WallTile(x, y) {
|
||||
var _this = _super.call(this, x, y, config.wallSprite, 0.2) || this;
|
||||
_this.baseTint = config.wallTint;
|
||||
@ -1310,12 +1313,10 @@ var WallTile = /** @class */ (function (_super) {
|
||||
_this.tileType = "wall";
|
||||
return _this;
|
||||
}
|
||||
|
||||
return WallTile;
|
||||
}(Tile));
|
||||
var IronTile = /** @class */ (function (_super) {
|
||||
__extends(IronTile, _super);
|
||||
|
||||
function IronTile(x, y) {
|
||||
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
||||
_this.baseTint = config.oreTint;
|
||||
@ -1324,12 +1325,10 @@ var IronTile = /** @class */ (function (_super) {
|
||||
_this.tileType = "iron";
|
||||
return _this;
|
||||
}
|
||||
|
||||
return IronTile;
|
||||
}(Tile));
|
||||
var CopperTile = /** @class */ (function (_super) {
|
||||
__extends(CopperTile, _super);
|
||||
|
||||
function CopperTile(x, y) {
|
||||
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
|
||||
_this.baseTint = config.oreTint;
|
||||
@ -1338,7 +1337,6 @@ var CopperTile = /** @class */ (function (_super) {
|
||||
_this.tileType = "copper";
|
||||
return _this;
|
||||
}
|
||||
|
||||
return CopperTile;
|
||||
}(Tile));
|
||||
var World = /** @class */ (function () {
|
||||
@ -1357,7 +1355,6 @@ var World = /** @class */ (function () {
|
||||
//Create tilemap
|
||||
this.setTerrain(terrain, size);
|
||||
}
|
||||
|
||||
/**
|
||||
* Load terrain data from array and create Tiles
|
||||
* @param terrain
|
||||
@ -1484,7 +1481,6 @@ var World = /** @class */ (function () {
|
||||
*/
|
||||
var WorldArrow = /** @class */ (function (_super) {
|
||||
__extends(WorldArrow, _super);
|
||||
|
||||
function WorldArrow(x, y, frame, direction) {
|
||||
var _this = _super.call(this, mar.game, x, y, 10, "sheet", frame) || this;
|
||||
var self = _this;
|
||||
@ -1513,7 +1509,6 @@ var WorldArrow = /** @class */ (function (_super) {
|
||||
});
|
||||
return _this;
|
||||
}
|
||||
|
||||
return WorldArrow;
|
||||
}(Phaser.Plugin.Isometric.IsoSprite));
|
||||
//todo pull this off the server or something?
|
||||
@ -1541,7 +1536,6 @@ var PlainTextConsoleMode = /** @class */ (function () {
|
||||
this.width = lineWidth;
|
||||
this.dialImage = dialImage;
|
||||
}
|
||||
|
||||
return PlainTextConsoleMode;
|
||||
}());
|
||||
var PlainTextConsole = /** @class */ (function () {
|
||||
@ -1582,7 +1576,6 @@ var PlainTextConsole = /** @class */ (function () {
|
||||
this.modes.push(new PlainTextConsoleMode(64, "./images/knob-10.png"));
|
||||
this.mode = 3; //Mode 56
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle dark/light theme
|
||||
*/
|
||||
|
43
mar/app.min.js
vendored
43
mar/app.min.js
vendored
@ -19,23 +19,24 @@ this.hudGroup);this.addDebugMessage(new WorldIndicator(10,20));this.tileIndicato
|
||||
b&&b.apply(this,arguments)||this}__extends(a,b);a.prototype.getMessage=function(){return void 0!=mar.world?"World: ("+Number(mar.client.worldX).toString(16).toUpperCase()+", "+Number(mar.client.worldY).toString(16).toUpperCase()+")":"Loading..."};return a}(DebugMessage),RENDERER_WIDTH=document.getElementById("game").clientWidth*window.devicePixelRatio,RENDERER_HEIGHT=window.innerHeight/1.4*window.devicePixelRatio,DEBUG=!0,config={tileTint:16777215,wallTint:14540253,oreTint:15987699,cubotHoverTint:65280,
|
||||
cubotTint:16777215,textFill:"#FFFFFF",textStroke:"#9298a8",biomassTint:6535263,biomassHoverTint:65280,tileHoverTint:65280,itemIron:4408129,textIron:"#434341",itemCopper:13139256,textCopper:"#C87D38",hologramFill:"#0aced6",hologramStroke:"#12FFB0",copperFill:"#C87D38",plainSprite:"tiles/tile",wallSprite:"tiles/bigTile",walkDuration:800,holoStyle:function(b){return{fontSize:32,fill:b?b:config.hologramFill,stroke:config.hologramStroke,strokeThickness:1,font:"fixedsys"}},kbBufferX:225,kbBufferY:20,arrowTextStyle:{fontSize:32,
|
||||
fill:"#ffffff",stroke:"#9298a8",strokeThickness:1,font:"fixedsys"},lowEnergy:100,lowEnergyTint:13369344,bigMessageFill:"#ff803d",arrowTint:16777215,arrowHoverTint:65280,selfUsernameColor:16469258,otherCubotAlpha:.6,defaultWorldSize:16},Util=function(){function b(){}b.getIsoY=function(a){return b.getIsoX(a)};b.getIsoX=function(a){return 71.5*a};b.getDeltaX=function(a){switch(a){case Direction.NORTH:case Direction.SOUTH:return 0;case Direction.EAST:return 1;case Direction.WEST:return-1}};b.getDeltaY=
|
||||
function(a){switch(a){case Direction.EAST:case Direction.WEST:return 0;case Direction.NORTH:return 1;case Direction.SOUTH:return-1}};return b}(),mar=new MarGame,KeyboardBuffer=function(b){function a(){var a=null!==b&&b.apply(this,arguments)||this;a.keys=[];return a}__extends(a,b);a.prototype.getMessage=function(){for(var a="KB: ",b=0;16>b;b++)a=void 0!==this.keys[b]?a+(this.keys[b].toString(16).toUpperCase()+" "):a+"__ ";return a};return a}(DebugMessage),ObjectsListener=function(){function b(){}b.prototype.getListenedMessageType=
|
||||
function(){return"object"};b.prototype.handle=function(a){DEBUG&&console.log("[MAR] Received "+a.objects.length+" objects");void 0!=mar.world&&mar.world.handleObjectsUpdate(a.objects)};return b}(),TickListener=function(){function b(){}b.prototype.getListenedMessageType=function(){return"tick"};b.prototype.handle=function(a){mar.client.requestObjects();void 0!==a.keys&&(mar.client.keyboardBuffer.keys=a.keys);void 0!=a.c&&(mar.client.consoleScreen.handleConsoleBufferUpdate(a.c,a.cm),DEBUG&&console.log("[MAR] Received "+
|
||||
a.c.length+" console message(s)"))};return b}(),UserInfoListener=function(){function b(){}b.prototype.getListenedMessageType=function(){return"userInfo"};b.prototype.handle=function(a){DEBUG&&console.log("[MAR] Received user info message");mar.client.worldX=a.worldX;mar.client.worldY=a.worldY;mar.client.maxWidth=a.maxWidth;mar.client.requestTerrain()};return b}(),AuthListener=function(){function b(){}b.prototype.getListenedMessageType=function(){return"auth"};b.prototype.handle=function(a){DEBUG&&
|
||||
console.log("[MAR] Received auth response");"ok"===a.m?(DEBUG&&console.log("[MAR] Auth successful"),mar.client.requestUserInfo()):alert("Authentication failed. Please make sure you are logged in and reload the page.")};return b}(),TerrainListener=function(){function b(){}b.prototype.getListenedMessageType=function(){return"terrain"};b.prototype.handle=function(a){DEBUG&&console.log("[MAR] Received terrain");mar.world&&mar.world.removeBigMessage();if(a.ok){var c=a.size;void 0==c&&(c=config.defaultWorldSize);
|
||||
DEBUG&&console.log("[MAR] World is available");null!=mar.world?(DEBUG&&console.log("[MAR] Updating World terrain"),mar.world.updateTerrain(a.terrain,c)):(DEBUG&&console.log("[MAR] Creating new World"),mar.world=new World(a.terrain,c))}else DEBUG&&console.log("[MAR] World is not available"),null!=mar.world?(DEBUG&&console.log("[MAR] Updating World terrain"),mar.world.updateTerrain([],config.defaultWorldSize)):(DEBUG&&console.log("[MAR] Creating new World"),mar.world=new World([],config.defaultWorldSize)),
|
||||
mar.world&&mar.world.setBigMessage("[Uncharted World]")};return b}(),CodeListener=function(){function b(){}b.prototype.getListenedMessageType=function(){return"code"};b.prototype.handle=function(a){ace.edit("editor").setValue(a.code)};return b}(),CodeResponseListener=function(){function b(){}b.prototype.getListenedMessageType=function(){return"codeResponse"};b.prototype.handle=function(a){alert("Uploaded and assembled "+a.bytes+" bytes ("+a.exceptions+" errors)")};return b}(),GameClient=function(){function b(){this.listeners=
|
||||
[];this.getServerInfo();this.consoleScreen=new PlainTextConsole(defaultText,"consoleText","colorButton","scrollButton","resetButton","widthDial")}b.prototype.requestUserInfo=function(){DEBUG&&console.log("[MAR] Requesting user info");this.socket.send(JSON.stringify({t:"userInfo"}))};b.prototype.requestTerrain=function(){DEBUG&&console.log("[MAR] Requesting terrain for world ("+this.worldX+", "+this.worldY+")");this.socket.send(JSON.stringify({t:"terrain",x:this.worldX,y:this.worldY}));this.requestObjects()};
|
||||
b.prototype.uploadCode=function(a){DEBUG&&console.log("[MAR] Uploaded code");this.socket.send(JSON.stringify({t:"uploadCode",code:a}))};b.prototype.reloadCode=function(){DEBUG&&console.log("[MAR] Reloading code");this.socket.send(JSON.stringify({t:"codeRequest"}))};b.prototype.sendKeyPress=function(a){DEBUG&&console.log("[MAR] Sent KeyPress: "+a);0!==a&&this.socket.send(JSON.stringify({t:"k",k:a}))};b.prototype.requestFloppy=function(){document.getElementById("floppyDown").innerHTML='<i class="fa fa-cog fa-spin fa-fw"></i>';
|
||||
DEBUG&&console.log("[MAR] Requesting floppy");this.socket.send(JSON.stringify({t:"floppyDown"}))};b.prototype.notifyFloppyUp=function(){DEBUG&&console.log("[MAR] Notifying the game server of floppy upload");this.socket.send(JSON.stringify({t:"floppyUp"}))};b.prototype.requestObjects=function(){DEBUG&&console.log("[MAR] Requesting game objects");this.socket.send(JSON.stringify({t:"object",x:this.worldX,y:this.worldY}))};b.prototype.getServerInfo=function(){var a=this;DEBUG&&console.log("[MAR] Getting server info... ");
|
||||
var c=new XMLHttpRequest;c.open("GET","./getServerInfo.php",!0);c.onreadystatechange=function(){4===c.readyState&&200===c.status&&(DEBUG&&console.log("[MAR] Received server info "+c.responseText),setTimeout(a.connectToGameServer(JSON.parse(c.responseText)),100))};c.send(null)};b.prototype.connectToGameServer=function(a){var c=this;DEBUG&&console.log("[MAR] Connecting to "+a.address);this.socket=new WebSocket(a.address);this.username=a.username;this.tickLength=a.tickLength;this.serverName=a.serverName;
|
||||
this.socket.binaryType="arraybuffer";this.socket.onopen=function(){DEBUG&&console.log("[MAR] Connected. Sent auth request");c.socket.send(a.token);c.listeners.push(new UserInfoListener);c.listeners.push(new AuthListener);c.listeners.push(new TickListener);c.listeners.push(new TerrainListener);c.listeners.push(new ObjectsListener);c.listeners.push(new CodeResponseListener);c.listeners.push(new CodeListener);c.socket.onmessage=function(a){try{var b=JSON.parse(a.data);DEBUG&&console.log("[MAR] Received: "+
|
||||
a.data);for(var d=0;d<c.listeners.length;d++)c.listeners[d].getListenedMessageType()===b.t&&c.listeners[d].handle(b)}catch(h){DEBUG&&(console.log("[MAR] Received invalid message, assuming floppy data"),document.getElementById("floppyDown").innerHTML='<i class="fa fa-long-arrow-down" aria-hidden="true"></i> <i class="fa fa-floppy-o" aria-hidden="true"></i>',a=new Blob([a.data],{type:"application/octet-stream"}),saveAs(a,"floppy.bin"))}};c.reloadCode()};this.socket.onerror=function(c){alert("Can't connect to game server at address "+
|
||||
a.address);console.log(c)};this.socket.onclose=function(a){mar.world.setBigMessage("Disconnected from server :(");console.log(a)};this.initGame()};b.prototype.initGame=function(){if("guest"!=this.username){var a=this;this.keyboardBuffer=new KeyboardBuffer(config.kbBufferX,config.kbBufferY);mar.addDebugMessage(this.keyboardBuffer);mar.game.input.keyboard.onDownCallback=function(c){document.activeElement===document.getElementById("game")&&((37<=c.keyCode&&40>=c.keyCode||116===c.keyCode||32===c.keyCode)&&
|
||||
c.preventDefault(),"guest"!==a.username&&16>=a.keyboardBuffer.keys.length&&(a.sendKeyPress(c.keyCode),a.keyboardBuffer.keys.push(c.keyCode)))}}};b.prototype.findMyRobot=function(){"guest"==this.username?alert("You are not logged in!"):this.requestUserInfo()};return b}(),ObjectType;(function(b){b[b.CUBOT=1]="CUBOT";b[b.BIOMASS=2]="BIOMASS";b[b.HARVESTER_NPC=10]="HARVESTER_NPC";b[b.FACTORY=3]="FACTORY";b[b.RADIO_TOWER=4]="RADIO_TOWER"})(ObjectType||(ObjectType={}));var ItemType;
|
||||
(function(b){b[b.BIOMASS=1]="BIOMASS";b[b.IRON=3]="IRON";b[b.COPPER=4]="COPPER"})(ItemType||(ItemType={}));var Action;(function(b){b[b.IDLE=0]="IDLE";b[b.DIGGING=1]="DIGGING";b[b.WALKING=2]="WALKING";b[b.WITHDRAWING=3]="WITHDRAWING";b[b.DEPOSITING=4]="DEPOSITING";b[b.LISTENING=5]="LISTENING";b[b.JUMPING=6]="JUMPING"})(Action||(Action={}));
|
||||
var GameObject=function(b){function a(a,d,e,f,h){return b.call(this,mar.game,a,d,e,f,h)||this}__extends(a,b);a.createObject=function(a){switch(a.t){case ObjectType.CUBOT:return new Cubot(a);case ObjectType.BIOMASS:return new BiomassBlob(a);case ObjectType.HARVESTER_NPC:return new HarvesterNPC(a);case ObjectType.FACTORY:return new Factory(a);case ObjectType.RADIO_TOWER:return new RadioTower(a);default:return null}};a.prototype.setText=function(a){this.text=mar.game.make.text(0,0,a,{fontSize:22,fill:config.textFill,
|
||||
stroke:config.textStroke,strokeThickness:2,font:"fixedsys"});this.text.anchor.set(.5,0);this.addChild(this.text)};a.prototype.isAt=function(a,b){return a==this.tileX&&b==this.tileY};return a}(Phaser.Plugin.Isometric.IsoSprite),HologramMode;(function(b){b[b.CLEARED=0]="CLEARED";b[b.HEX=1]="HEX";b[b.STRING=2]="STRING";b[b.DEC=3]="DEC"})(HologramMode||(HologramMode={}));
|
||||
function(a){switch(a){case Direction.EAST:case Direction.WEST:return 0;case Direction.NORTH:return 1;case Direction.SOUTH:return-1}};return b}(),mar=new MarGame,myVarX=.46,myVarY=.46,KeyboardBuffer=function(b){function a(){var a=null!==b&&b.apply(this,arguments)||this;a.keys=[];return a}__extends(a,b);a.prototype.getMessage=function(){for(var a="KB: ",b=0;16>b;b++)a=void 0!==this.keys[b]?a+(this.keys[b].toString(16).toUpperCase()+" "):a+"__ ";return a};return a}(DebugMessage),ObjectsListener=function(){function b(){}
|
||||
b.prototype.getListenedMessageType=function(){return"object"};b.prototype.handle=function(a){DEBUG&&console.log("[MAR] Received "+a.objects.length+" objects");void 0!=mar.world&&mar.world.handleObjectsUpdate(a.objects)};return b}(),TickListener=function(){function b(){}b.prototype.getListenedMessageType=function(){return"tick"};b.prototype.handle=function(a){mar.client.requestObjects();void 0!==a.keys&&(mar.client.keyboardBuffer.keys=a.keys);void 0!=a.c&&(mar.client.consoleScreen.handleConsoleBufferUpdate(a.c,
|
||||
a.cm),DEBUG&&console.log("[MAR] Received "+a.c.length+" console message(s)"))};return b}(),UserInfoListener=function(){function b(){}b.prototype.getListenedMessageType=function(){return"userInfo"};b.prototype.handle=function(a){DEBUG&&console.log("[MAR] Received user info message");mar.client.worldX=a.worldX;mar.client.worldY=a.worldY;mar.client.maxWidth=a.maxWidth;mar.client.requestTerrain()};return b}(),AuthListener=function(){function b(){}b.prototype.getListenedMessageType=function(){return"auth"};
|
||||
b.prototype.handle=function(a){DEBUG&&console.log("[MAR] Received auth response");"ok"===a.m?(DEBUG&&console.log("[MAR] Auth successful"),mar.client.requestUserInfo()):alert("Authentication failed. Please make sure you are logged in and reload the page.")};return b}(),TerrainListener=function(){function b(){}b.prototype.getListenedMessageType=function(){return"terrain"};b.prototype.handle=function(a){DEBUG&&console.log("[MAR] Received terrain");mar.world&&mar.world.removeBigMessage();if(a.ok){var c=
|
||||
a.size;void 0==c&&(c=config.defaultWorldSize);DEBUG&&console.log("[MAR] World is available");null!=mar.world?(DEBUG&&console.log("[MAR] Updating World terrain"),mar.world.updateTerrain(a.terrain,c)):(DEBUG&&console.log("[MAR] Creating new World"),mar.world=new World(a.terrain,c))}else DEBUG&&console.log("[MAR] World is not available"),null!=mar.world?(DEBUG&&console.log("[MAR] Updating World terrain"),mar.world.updateTerrain([],config.defaultWorldSize)):(DEBUG&&console.log("[MAR] Creating new World"),
|
||||
mar.world=new World([],config.defaultWorldSize)),mar.world&&mar.world.setBigMessage("[Uncharted World]")};return b}(),CodeListener=function(){function b(){}b.prototype.getListenedMessageType=function(){return"code"};b.prototype.handle=function(a){ace.edit("editor").setValue(a.code)};return b}(),CodeResponseListener=function(){function b(){}b.prototype.getListenedMessageType=function(){return"codeResponse"};b.prototype.handle=function(a){alert("Uploaded and assembled "+a.bytes+" bytes ("+a.exceptions+
|
||||
" errors)")};return b}(),GameClient=function(){function b(){this.listeners=[];this.getServerInfo();this.consoleScreen=new PlainTextConsole(defaultText,"consoleText","colorButton","scrollButton","resetButton","widthDial")}b.prototype.requestUserInfo=function(){DEBUG&&console.log("[MAR] Requesting user info");this.socket.send(JSON.stringify({t:"userInfo"}))};b.prototype.requestTerrain=function(){DEBUG&&console.log("[MAR] Requesting terrain for world ("+this.worldX+", "+this.worldY+")");this.socket.send(JSON.stringify({t:"terrain",
|
||||
x:this.worldX,y:this.worldY}));this.requestObjects()};b.prototype.uploadCode=function(a){DEBUG&&console.log("[MAR] Uploaded code");this.socket.send(JSON.stringify({t:"uploadCode",code:a}))};b.prototype.reloadCode=function(){DEBUG&&console.log("[MAR] Reloading code");this.socket.send(JSON.stringify({t:"codeRequest"}))};b.prototype.sendKeyPress=function(a){DEBUG&&console.log("[MAR] Sent KeyPress: "+a);0!==a&&this.socket.send(JSON.stringify({t:"k",k:a}))};b.prototype.requestFloppy=function(){document.getElementById("floppyDown").innerHTML=
|
||||
'<i class="fa fa-cog fa-spin fa-fw"></i>';DEBUG&&console.log("[MAR] Requesting floppy");this.socket.send(JSON.stringify({t:"floppyDown"}))};b.prototype.notifyFloppyUp=function(){DEBUG&&console.log("[MAR] Notifying the game server of floppy upload");this.socket.send(JSON.stringify({t:"floppyUp"}))};b.prototype.requestObjects=function(){DEBUG&&console.log("[MAR] Requesting game objects");this.socket.send(JSON.stringify({t:"object",x:this.worldX,y:this.worldY}))};b.prototype.getServerInfo=function(){var a=
|
||||
this;DEBUG&&console.log("[MAR] Getting server info... ");var c=new XMLHttpRequest;c.open("GET","./getServerInfo.php",!0);c.onreadystatechange=function(){4===c.readyState&&200===c.status&&(DEBUG&&console.log("[MAR] Received server info "+c.responseText),setTimeout(a.connectToGameServer(JSON.parse(c.responseText)),100))};c.send(null)};b.prototype.connectToGameServer=function(a){var c=this;DEBUG&&console.log("[MAR] Connecting to "+a.address);this.socket=new WebSocket(a.address);this.username=a.username;
|
||||
this.tickLength=a.tickLength;this.serverName=a.serverName;this.socket.binaryType="arraybuffer";this.socket.onopen=function(){DEBUG&&console.log("[MAR] Connected. Sent auth request");c.socket.send(a.token);c.listeners.push(new UserInfoListener);c.listeners.push(new AuthListener);c.listeners.push(new TickListener);c.listeners.push(new TerrainListener);c.listeners.push(new ObjectsListener);c.listeners.push(new CodeResponseListener);c.listeners.push(new CodeListener);c.socket.onmessage=function(a){try{var b=
|
||||
JSON.parse(a.data);DEBUG&&console.log("[MAR] Received: "+a.data);for(var d=0;d<c.listeners.length;d++)c.listeners[d].getListenedMessageType()===b.t&&c.listeners[d].handle(b)}catch(h){DEBUG&&(console.log("[MAR] Received invalid message, assuming floppy data"),document.getElementById("floppyDown").innerHTML='<i class="fa fa-long-arrow-down" aria-hidden="true"></i> <i class="fa fa-floppy-o" aria-hidden="true"></i>',a=new Blob([a.data],{type:"application/octet-stream"}),saveAs(a,"floppy.bin"))}};c.reloadCode()};
|
||||
this.socket.onerror=function(c){alert("Can't connect to game server at address "+a.address);console.log(c)};this.socket.onclose=function(a){mar.world.setBigMessage("Disconnected from server :(");console.log(a)};this.initGame()};b.prototype.initGame=function(){if("guest"!=this.username){var a=this;this.keyboardBuffer=new KeyboardBuffer(config.kbBufferX,config.kbBufferY);mar.addDebugMessage(this.keyboardBuffer);mar.game.input.keyboard.onDownCallback=function(c){document.activeElement===document.getElementById("game")&&
|
||||
((37<=c.keyCode&&40>=c.keyCode||116===c.keyCode||32===c.keyCode)&&c.preventDefault(),"guest"!==a.username&&16>=a.keyboardBuffer.keys.length&&(a.sendKeyPress(c.keyCode),a.keyboardBuffer.keys.push(c.keyCode)))}}};b.prototype.findMyRobot=function(){"guest"==this.username?alert("You are not logged in!"):this.requestUserInfo()};return b}(),ObjectType;
|
||||
(function(b){b[b.CUBOT=1]="CUBOT";b[b.BIOMASS=2]="BIOMASS";b[b.HARVESTER_NPC=10]="HARVESTER_NPC";b[b.FACTORY=3]="FACTORY";b[b.RADIO_TOWER=4]="RADIO_TOWER";b[b.VAULT_DOOR=5]="VAULT_DOOR"})(ObjectType||(ObjectType={}));var ItemType;(function(b){b[b.BIOMASS=1]="BIOMASS";b[b.IRON=3]="IRON";b[b.COPPER=4]="COPPER"})(ItemType||(ItemType={}));var Action;
|
||||
(function(b){b[b.IDLE=0]="IDLE";b[b.DIGGING=1]="DIGGING";b[b.WALKING=2]="WALKING";b[b.WITHDRAWING=3]="WITHDRAWING";b[b.DEPOSITING=4]="DEPOSITING";b[b.LISTENING=5]="LISTENING";b[b.JUMPING=6]="JUMPING"})(Action||(Action={}));
|
||||
var GameObject=function(b){function a(a,d,e,f,h){return b.call(this,mar.game,a,d,e,f,h)||this}__extends(a,b);a.createObject=function(a){switch(a.t){case ObjectType.CUBOT:return new Cubot(a);case ObjectType.BIOMASS:return new BiomassBlob(a);case ObjectType.HARVESTER_NPC:return new HarvesterNPC(a);case ObjectType.FACTORY:return new Factory(a);case ObjectType.RADIO_TOWER:return new RadioTower(a);case ObjectType.VAULT_DOOR:return new VaultDoor(a);default:return null}};a.prototype.setText=function(a){this.text=
|
||||
mar.game.make.text(0,0,a,{fontSize:22,fill:config.textFill,stroke:config.textStroke,strokeThickness:2,font:"fixedsys"});this.text.anchor.set(.5,0);this.addChild(this.text)};a.prototype.isAt=function(a,b){return a==this.tileX&&b==this.tileY};return a}(Phaser.Plugin.Isometric.IsoSprite),HologramMode;(function(b){b[b.CLEARED=0]="CLEARED";b[b.HEX=1]="HEX";b[b.STRING=2]="STRING";b[b.DEC=3]="DEC"})(HologramMode||(HologramMode={}));
|
||||
var Cubot=function(b){function a(a){var c=b.call(this,Util.getIsoX(a.x),Util.getIsoY(a.y),15,"sheet",null)||this;c.queuedAnimations=[];c.hovered=!1;DEBUG&&console.log("Creating Cubot object");c.anchor.set(.5,0);c.id=a.i;c.tileX=a.x;c.tileY=a.y;c.username=a.parent;c.heldItem=a.heldItem;c.direction=a.direction;c.action=a.action;c.energy=a.energy;c.animations.add("walk_w",mar.animationFrames.walk_w);c.animations.add("walk_s",mar.animationFrames.walk_s);c.animations.add("walk_e",mar.animationFrames.walk_e);
|
||||
c.animations.add("walk_n",mar.animationFrames.walk_n);c.animations.add("dig_w",mar.animationFrames.dig_w);c.animations.add("dig_s",mar.animationFrames.dig_s);c.animations.add("dig_e",mar.animationFrames.dig_e);c.animations.add("dig_n",mar.animationFrames.dig_n);c.createUsername();c.updateDirection();c.tint=c.getTint();return c}__extends(a,b);a.prototype.onTileHover=function(){mar.game.add.tween(this).to({isoZ:45},200,Phaser.Easing.Quadratic.InOut,!0);mar.game.add.tween(this.scale).to({x:1.2,y:1.2},
|
||||
200,Phaser.Easing.Linear.None,!0);this.tint=config.cubotHoverTint;void 0!==this.text&&(this.text.visible=!0);this.hovered=!0};a.prototype.onTileExit=function(){mar.game.add.tween(this).to({isoZ:15},400,Phaser.Easing.Bounce.Out,!0);mar.game.add.tween(this.scale).to({x:1,y:1},200,Phaser.Easing.Linear.None,!0);void 0!==this.text&&(this.text.visible=!1);this.hovered=!1;this.tint=this.getTint()};a.prototype.getTint=function(){return this.hovered?config.cubotHoverTint:this.energy<=config.lowEnergy?config.lowEnergyTint:
|
||||
@ -49,9 +50,11 @@ a.animations.add("walk_e",mar.animationFrames.harvester_walk_e);a.animations.add
|
||||
10,"sheet",1)||this;DEBUG&&console.log("Creating Biomass object");c.anchor.set(.5,0);c.id=a.i;c.tileX=a.x;c.tileY=a.y;c.tint=config.biomassTint;c.animations.add("idle",mar.animationFrames.biomassIdle);c.animations.play("idle",45,!0);c.setText("Biomass");c.text.visible=!1;return c}__extends(a,b);a.prototype.onTileHover=function(){mar.game.tweens.removeFrom(this);mar.game.add.tween(this).to({isoZ:45},200,Phaser.Easing.Quadratic.InOut,!0);this.tint=config.biomassHoverTint;mar.game.add.tween(this.scale).to({x:1.2,
|
||||
y:1.2},200,Phaser.Easing.Linear.None,!0);this.text.visible=!0};a.prototype.onTileExit=function(){mar.game.tweens.removeFrom(this);mar.game.add.tween(this).to({isoZ:15},400,Phaser.Easing.Bounce.Out,!0);mar.game.add.tween(this.scale).to({x:1,y:1},200,Phaser.Easing.Linear.None,!0);this.tint=config.biomassTint;this.text.visible=!1};a.prototype.updateObject=function(a){DEBUG&&console.log("Updating Biomass object")};return a}(GameObject),Factory=function(b){function a(a){var c=b.call(this,Util.getIsoX(a.x),
|
||||
Util.getIsoY(a.y),15,"sheet","objects/factory")||this;c.anchor.set(.5,.25);c.setText("Factory");c.text.visible=!1;c.id=a.i;c.tileX=a.x;c.tileY=a.y;return c}__extends(a,b);a.prototype.onTileHover=function(){mar.game.tweens.removeFrom(this);mar.game.add.tween(this).to({isoZ:25},200,Phaser.Easing.Quadratic.InOut,!0);mar.game.add.tween(this.scale).to({x:1.06,y:1.06},200,Phaser.Easing.Linear.None,!0);this.tint=config.cubotHoverTint;this.text.visible=!0};a.prototype.onTileExit=function(){mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ:15},400,Phaser.Easing.Bounce.Out,!0);mar.game.add.tween(this.scale).to({x:1,y:1},200,Phaser.Easing.Linear.None,!0);this.tint=config.cubotTint;this.text.visible=!1};a.prototype.updateObject=function(a){};a.prototype.isAt=function(a,b){return(this.tileX===a||this.tileX+1===a)&&(this.tileY+1===b||this.tileY===b)};return a}(GameObject),RadioTower=function(b){function a(a){var c=b.call(this,Util.getIsoX(a.x),Util.getIsoY(a.y),15,"sheet","objects/RadioTower")||this;c.anchor.set(.5,
|
||||
.64);c.setText("Radio Tower");c.text.visible=!1;c.id=a.i;c.tileX=a.x;c.tileY=a.y;return c}__extends(a,b);a.prototype.onTileHover=function(){mar.game.tweens.removeFrom(this);mar.game.add.tween(this).to({isoZ:25},200,Phaser.Easing.Quadratic.InOut,!0);mar.game.add.tween(this.scale).to({x:1.06,y:1.06},200,Phaser.Easing.Linear.None,!0);this.tint=config.cubotHoverTint;this.text.visible=!0};a.prototype.onTileExit=function(){mar.game.tweens.removeFrom(this);mar.game.add.tween(this).to({isoZ:15},400,Phaser.Easing.Bounce.Out,
|
||||
!0);mar.game.add.tween(this.scale).to({x:1,y:1},200,Phaser.Easing.Linear.None,!0);this.tint=config.cubotTint;this.text.visible=!1};a.prototype.updateObject=function(a){};return a}(GameObject),Direction;(function(b){b[b.NORTH=0]="NORTH";b[b.EAST=1]="EAST";b[b.SOUTH=2]="SOUTH";b[b.WEST=3]="WEST"})(Direction||(Direction={}));var TileType;(function(b){b[b.PLAIN=0]="PLAIN";b[b.WALL=1]="WALL";b[b.IRON=2]="IRON";b[b.COPPER=3]="COPPER"})(TileType||(TileType={}));
|
||||
mar.game.add.tween(this).to({isoZ:15},400,Phaser.Easing.Bounce.Out,!0);mar.game.add.tween(this.scale).to({x:1,y:1},200,Phaser.Easing.Linear.None,!0);this.tint=config.cubotTint;this.text.visible=!1};a.prototype.updateObject=function(a){};a.prototype.isAt=function(a,b){return(this.tileX===a||this.tileX+1===a)&&(this.tileY+1===b||this.tileY===b)};return a}(GameObject),RadioTower=function(b){function a(a){var c=b.call(this,Util.getIsoX(a.x),Util.getIsoY(a.y),15,"sheet","objects/RadioTower")||this;c.anchor.set(.48,
|
||||
.65);c.setText("Radio Tower");c.text.visible=!1;c.id=a.i;c.tileX=a.x;c.tileY=a.y;return c}__extends(a,b);a.prototype.onTileHover=function(){mar.game.tweens.removeFrom(this);mar.game.add.tween(this).to({isoZ:25},200,Phaser.Easing.Quadratic.InOut,!0);mar.game.add.tween(this.scale).to({x:1.06,y:1.06},200,Phaser.Easing.Linear.None,!0);this.tint=config.cubotHoverTint;this.text.visible=!0};a.prototype.onTileExit=function(){mar.game.tweens.removeFrom(this);mar.game.add.tween(this).to({isoZ:15},400,Phaser.Easing.Bounce.Out,
|
||||
!0);mar.game.add.tween(this.scale).to({x:1,y:1},200,Phaser.Easing.Linear.None,!0);this.tint=config.cubotTint;this.text.visible=!1};a.prototype.updateObject=function(a){};return a}(GameObject),VaultDoor=function(b){function a(a){var c=b.call(this,Util.getIsoX(a.x),Util.getIsoY(a.y),15,"sheet","objects/VaultDoor")||this;c.anchor.set(myVarX,myVarY);c.setText("Vault");c.text.visible=!1;c.id=a.i;c.tileX=a.x;c.tileY=a.y;return c}__extends(a,b);a.prototype.onTileHover=function(){mar.game.tweens.removeFrom(this);
|
||||
mar.game.add.tween(this).to({isoZ:25},200,Phaser.Easing.Quadratic.InOut,!0);mar.game.add.tween(this.scale).to({x:1.06,y:1.06},200,Phaser.Easing.Linear.None,!0);this.tint=config.cubotHoverTint;this.text.visible=!0};a.prototype.onTileExit=function(){mar.game.tweens.removeFrom(this);mar.game.add.tween(this).to({isoZ:15},400,Phaser.Easing.Bounce.Out,!0);mar.game.add.tween(this.scale).to({x:1,y:1},200,Phaser.Easing.Linear.None,!0);this.tint=config.cubotTint;this.text.visible=!1};a.prototype.updateObject=
|
||||
function(a){};return a}(GameObject),Direction;(function(b){b[b.NORTH=0]="NORTH";b[b.EAST=1]="EAST";b[b.SOUTH=2]="SOUTH";b[b.WEST=3]="WEST"})(Direction||(Direction={}));var TileType;(function(b){b[b.PLAIN=0]="PLAIN";b[b.WALL=1]="WALL";b[b.IRON=2]="IRON";b[b.COPPER=3]="COPPER"})(TileType||(TileType={}));
|
||||
var Tile=function(b){function a(a,d,e,f){e=b.call(this,mar.game,Util.getIsoX(a),Util.getIsoY(d),0,"sheet",e)||this;e.baseZ=0;e.tileX=a;e.tileY=d;e.anchor.set(.5,f);return e}__extends(a,b);a.createTile=function(a,b,e){switch(a){case TileType.WALL:return new WallTile(b,e);case TileType.IRON:return new IronTile(b,e);case TileType.COPPER:return new CopperTile(b,e);default:return new PlainTile(b,e)}};a.prototype.onHover=function(){this.tint=config.tileHoverTint;mar.game.add.tween(this).to({isoZ:this.baseZ+
|
||||
8},200,Phaser.Easing.Quadratic.InOut,!0);mar.tileIndicator.tileX=this.tileX;mar.tileIndicator.tileY=this.tileY;mar.tileIndicator.tileType=this.tileType};a.prototype.onExit=function(){this.tint=this.baseTint;mar.game.add.tween(this).to({isoZ:this.baseZ},200,Phaser.Easing.Quadratic.InOut,!0)};a.prototype.setText=function(a,b){void 0!==this.textSprite&&this.textSprite.destroy();this.textSprite=mar.game.make.text(0,16,a,{fontSize:22,fill:b,stroke:"#FFFFFF",strokeThickness:1,font:"fixedsys"});this.textSprite.alpha=
|
||||
.6;this.textSprite.anchor.set(.5,0);this.addChild(this.textSprite)};return a}(Phaser.Plugin.Isometric.IsoSprite),PlainTile=function(b){function a(a,d){a=b.call(this,a,d,config.plainSprite,0)||this;a.baseTint=config.tileTint;a.tint=a.baseTint;a.tileType="plain";return a}__extends(a,b);return a}(Tile),WallTile=function(b){function a(a,d){a=b.call(this,a,d,config.wallSprite,.2)||this;a.baseTint=config.wallTint;a.tint=a.baseTint;a.tileType="wall";return a}__extends(a,b);return a}(Tile),IronTile=function(b){function a(a,
|
||||
|
@ -96,3 +96,5 @@ class Util {
|
||||
|
||||
let mar = new MarGame();
|
||||
|
||||
var myVarX = 0.46;
|
||||
var myVarY = 0.46;
|
334
mar/sprites.json
334
mar/sprites.json
@ -4221,7 +4221,7 @@
|
||||
"sourceSize": {"w":128,"h":70},
|
||||
"pivot": {"x":0.5,"y":0.5}
|
||||
},
|
||||
"objects/factory":
|
||||
"objects/factory":
|
||||
{
|
||||
"frame": {"x":256,"y":1050,"w":256,"h":192},
|
||||
"rotated": false,
|
||||
@ -4275,52 +4275,76 @@
|
||||
"sourceSize": {"w":64,"h":64},
|
||||
"pivot": {"x":0.5,"y":0.5}
|
||||
},
|
||||
"objects/RadioTower": {
|
||||
"frame": {
|
||||
"x": 904,
|
||||
"y": 1050,
|
||||
"w": 168,
|
||||
"h": 237
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 168,
|
||||
"h": 237
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 168,
|
||||
"h": 237
|
||||
},
|
||||
"pivot": {
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
}
|
||||
},
|
||||
"objects/RadioTower": {
|
||||
"frame": {
|
||||
"x": 904,
|
||||
"y": 1050,
|
||||
"w": 168,
|
||||
"h": 237
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 168,
|
||||
"h": 237
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 168,
|
||||
"h": 237
|
||||
},
|
||||
"pivot": {
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
}
|
||||
},
|
||||
"objects/rocket":
|
||||
{
|
||||
"frame": {
|
||||
"x": 1072,
|
||||
"y": 1050,
|
||||
"w": 135,
|
||||
"h": 189
|
||||
},
|
||||
"frame": {
|
||||
"x": 1072,
|
||||
"y": 1050,
|
||||
"w": 135,
|
||||
"h": 189
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":135,"h":189},
|
||||
"sourceSize": {"w":135,"h":189},
|
||||
"pivot": {"x":0.5,"y":0.5}
|
||||
},
|
||||
"objects/VaultDoor": {
|
||||
"frame": {
|
||||
"x": 1207,
|
||||
"y": 1050,
|
||||
"w": 196,
|
||||
"h": 196
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 196,
|
||||
"h": 196
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 196,
|
||||
"h": 196
|
||||
},
|
||||
"pivot": {
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
}
|
||||
},
|
||||
"tiles/bigTile":
|
||||
{
|
||||
"frame": {
|
||||
"x": 1207,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 140
|
||||
},
|
||||
"frame": {
|
||||
"x": 1403,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 140
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":140},
|
||||
@ -4329,12 +4353,12 @@
|
||||
},
|
||||
"tiles/copper":
|
||||
{
|
||||
"frame": {
|
||||
"x": 1335,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 64
|
||||
},
|
||||
"frame": {
|
||||
"x": 1531,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 64
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":64},
|
||||
@ -4343,12 +4367,12 @@
|
||||
},
|
||||
"tiles/iron":
|
||||
{
|
||||
"frame": {
|
||||
"x": 1463,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 64
|
||||
},
|
||||
"frame": {
|
||||
"x": 1659,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 64
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":64},
|
||||
@ -4357,12 +4381,12 @@
|
||||
},
|
||||
"tiles/plain":
|
||||
{
|
||||
"frame": {
|
||||
"x": 1591,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 64
|
||||
},
|
||||
"frame": {
|
||||
"x": 1787,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 64
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":64},
|
||||
@ -4371,12 +4395,12 @@
|
||||
},
|
||||
"tiles/plain_s":
|
||||
{
|
||||
"frame": {
|
||||
"x": 1719,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 64
|
||||
},
|
||||
"frame": {
|
||||
"x": 1915,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 64
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":64},
|
||||
@ -4385,12 +4409,12 @@
|
||||
},
|
||||
"tiles/tile":
|
||||
{
|
||||
"frame": {
|
||||
"x": 1847,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 114
|
||||
},
|
||||
"frame": {
|
||||
"x": 2043,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 114
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":114},
|
||||
@ -4399,12 +4423,12 @@
|
||||
},
|
||||
"tiles/wall":
|
||||
{
|
||||
"frame": {
|
||||
"x": 1975,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 103
|
||||
},
|
||||
"frame": {
|
||||
"x": 2171,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 103
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":103},
|
||||
@ -4413,12 +4437,12 @@
|
||||
},
|
||||
"tiles/wall_s":
|
||||
{
|
||||
"frame": {
|
||||
"x": 2103,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 103
|
||||
},
|
||||
"frame": {
|
||||
"x": 2299,
|
||||
"y": 1050,
|
||||
"w": 128,
|
||||
"h": 103
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":128,"h":103},
|
||||
@ -4427,12 +4451,12 @@
|
||||
},
|
||||
"ui/arrow_east":
|
||||
{
|
||||
"frame": {
|
||||
"x": 2231,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"frame": {
|
||||
"x": 2427,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":102,"h":51},
|
||||
@ -4441,12 +4465,12 @@
|
||||
},
|
||||
"ui/arrow_east_s":
|
||||
{
|
||||
"frame": {
|
||||
"x": 2333,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"frame": {
|
||||
"x": 2529,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":102,"h":51},
|
||||
@ -4455,12 +4479,12 @@
|
||||
},
|
||||
"ui/arrow_north":
|
||||
{
|
||||
"frame": {
|
||||
"x": 2435,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"frame": {
|
||||
"x": 2631,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":102,"h":51},
|
||||
@ -4469,12 +4493,12 @@
|
||||
},
|
||||
"ui/arrow_north_s":
|
||||
{
|
||||
"frame": {
|
||||
"x": 2537,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"frame": {
|
||||
"x": 2733,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":102,"h":51},
|
||||
@ -4483,12 +4507,12 @@
|
||||
},
|
||||
"ui/arrow_south":
|
||||
{
|
||||
"frame": {
|
||||
"x": 2639,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"frame": {
|
||||
"x": 2835,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":102,"h":51},
|
||||
@ -4497,12 +4521,12 @@
|
||||
},
|
||||
"ui/arrow_south_s":
|
||||
{
|
||||
"frame": {
|
||||
"x": 2741,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"frame": {
|
||||
"x": 2937,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":102,"h":51},
|
||||
@ -4511,12 +4535,12 @@
|
||||
},
|
||||
"ui/arrow_west":
|
||||
{
|
||||
"frame": {
|
||||
"x": 2843,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"frame": {
|
||||
"x": 3039,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":102,"h":51},
|
||||
@ -4525,52 +4549,52 @@
|
||||
},
|
||||
"ui/arrow_west_s":
|
||||
{
|
||||
"frame": {
|
||||
"x": 2945,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"frame": {
|
||||
"x": 3141,
|
||||
"y": 1050,
|
||||
"w": 102,
|
||||
"h": 51
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {"x":0,"y":0,"w":102,"h":51},
|
||||
"sourceSize": {"w":102,"h":51},
|
||||
"pivot": {"x":0.5,"y":0.5}
|
||||
},
|
||||
"ui/compass": {
|
||||
"frame": {
|
||||
"x": 3047,
|
||||
"y": 1050,
|
||||
"w": 162,
|
||||
"h": 147
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 162,
|
||||
"h": 147
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 162,
|
||||
"h": 147
|
||||
},
|
||||
"pivot": {
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
}
|
||||
"ui/compass": {
|
||||
"frame": {
|
||||
"x": 3243,
|
||||
"y": 1050,
|
||||
"w": 162,
|
||||
"h": 147
|
||||
},
|
||||
"rotated": false,
|
||||
"trimmed": false,
|
||||
"spriteSourceSize": {
|
||||
"x": 0,
|
||||
"y": 0,
|
||||
"w": 162,
|
||||
"h": 147
|
||||
},
|
||||
"sourceSize": {
|
||||
"w": 162,
|
||||
"h": 147
|
||||
},
|
||||
"pivot": {
|
||||
"x": 0.5,
|
||||
"y": 0.5
|
||||
}
|
||||
}},
|
||||
"meta": {
|
||||
"app": "http://www.codeandweb.com/texturepacker",
|
||||
"version": "1.0",
|
||||
"image": "sprites.png",
|
||||
"format": "RGBA8888",
|
||||
"size": {
|
||||
"w": 3968,
|
||||
"h": 1287
|
||||
},
|
||||
"size": {
|
||||
"w": 3968,
|
||||
"h": 1287
|
||||
},
|
||||
"scale": "1",
|
||||
"smartupdate": "$TexturePacker:SmartUpdate:2f2171ef87c885b1443cc12a0a01c1d0:91e20f43dfff0054d5076c5515201ffc:1eabdf11f75e3a4fe3147baf7b5be24b$"
|
||||
"smartupdate": "$TexturePacker:SmartUpdate:2412f7b54f5052f26d527831b1731f90:0555c9ab081ab700e85a408b539476a7:1eabdf11f75e3a4fe3147baf7b5be24b$"
|
||||
}
|
||||
}
|
||||
|
BIN
mar/sprites.png
BIN
mar/sprites.png
Binary file not shown.
Before Width: | Height: | Size: 589 KiB After Width: | Height: | Size: 597 KiB |
Loading…
x
Reference in New Issue
Block a user