diff --git a/mar/Console.ts b/mar/Console.ts index a64e78f..1c9c42e 100644 --- a/mar/Console.ts +++ b/mar/Console.ts @@ -9,11 +9,7 @@ let defaultText = "Version 1.3A, 1985-05-17\n" + "Initialising Universal Communication Port connection...Done\n" + "Current date is 2790-01-14\n" + - "Cubot Status: Much Assembly Required" + - "\n" + - "\n" + - "\n" + - "More text down here\n"; + "Cubot Status: Much Assembly Required"; enum ConsoleMode { CLEAR, diff --git a/mar/GameObject.ts b/mar/GameObject.ts index f6f3528..2aa82be 100644 --- a/mar/GameObject.ts +++ b/mar/GameObject.ts @@ -222,9 +222,22 @@ class Cubot extends GameObject { // } } - // if (this.action == Action.DIGGING) { - // //TODO dig animation - // } + if (this.action == Action.DIGGING) { + switch (this.direction) { + case Direction.NORTH: + this.animations.play("dig_n", 60); + break; + case Direction.SOUTH: + this.animations.play("dig_s", 60); + break; + case Direction.EAST: + this.animations.play("dig_e", 60); + break; + case Direction.WEST: + this.animations.play("dig_w", 60); + break; + } + } this.updateDirection(); this.updateHologram(json.holoMode, json.holoC, json.holo, json.holoStr); diff --git a/mar/app.js b/mar/app.js index 75cf812..23dba0f 100644 --- a/mar/app.js +++ b/mar/app.js @@ -896,9 +896,22 @@ var Cubot = /** @class */ (function (_super) { // //TODO // } } - // if (this.action == Action.DIGGING) { - // //TODO dig animation - // } + if (this.action == Action.DIGGING) { + switch (this.direction) { + case Direction.NORTH: + this.animations.play("dig_n", 60); + break; + case Direction.SOUTH: + this.animations.play("dig_s", 60); + break; + case Direction.EAST: + this.animations.play("dig_e", 60); + break; + case Direction.WEST: + this.animations.play("dig_w", 60); + break; + } + } this.updateDirection(); this.updateHologram(json.holoMode, json.holoC, json.holo, json.holoStr); }; @@ -1191,7 +1204,6 @@ var RadioTower = /** @class */ (function (_super) { }(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); @@ -1202,7 +1214,6 @@ var VaultDoor = /** @class */ (function (_super) { _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); @@ -1521,11 +1532,7 @@ var defaultText = " _______ __ __\n" + "Version 1.3A, 1985-05-17\n" + "Initialising Universal Communication Port connection...Done\n" + "Current date is 2790-01-14\n" + - "Cubot Status: Much Assembly Required" + - "\n" + - "\n" + - "\n" + - "More text down here\n"; + "Cubot Status: Much Assembly Required"; var ConsoleMode; (function (ConsoleMode) { ConsoleMode[ConsoleMode["CLEAR"] = 0] = "CLEAR"; diff --git a/mar/app.min.js b/mar/app.min.js index c5b4dba..102397c 100644 --- a/mar/app.min.js +++ b/mar/app.min.js @@ -40,21 +40,22 @@ mar.game.make.text(0,0,a,{fontSize:22,fill:config.textFill,stroke:config.textStr 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: -config.cubotTint};a.prototype.updateObject=function(a){DEBUG&&console.log("Updating Cubot object");this.action=a.action;this.energy=a.energy;this.direction=a.direction;this.tint=this.getTint();this.isAt(a.x,a.y)||this.action!=Action.WALKING||(this.tileX=a.x,this.tileY=a.y,this.walk());this.updateDirection();this.updateHologram(a.holoMode,a.holoC,a.holo,a.holoStr)};a.prototype.updateHologram=function(a,b,e,f){void 0==this.hologram&&(this.hologram=mar.game.make.text(0,32,""),this.hologram.anchor.set(.5, -0),this.addChild(this.hologram));this.hologram.setStyle(config.holoStyle(b));switch(a){case HologramMode.CLEARED:this.hologram.text="";break;case HologramMode.DEC:this.hologram.text=Number(e).toString();break;case HologramMode.HEX:this.hologram.text="0x"+("0000"+Number(e).toString(16).toUpperCase()).slice(-4);break;case HologramMode.STRING:this.hologram.text=f.replace(/[\n|\t]/g,"")}};a.prototype.updateDirection=function(){switch(this.direction){case Direction.NORTH:this.animations.frameName="cubot/walk_n/0001"; -break;case Direction.EAST:this.animations.frameName="cubot/walk_e/0001";break;case Direction.SOUTH:this.animations.frameName="cubot/walk_s/0001";break;case Direction.WEST:this.animations.frameName="cubot/walk_w/0001"}};a.prototype.walk=function(){var a=this,b=function(b){b=mar.game.add.tween(a).to({isoX:Util.getIsoX(a.tileX),isoY:Util.getIsoY(a.tileY)},b,Phaser.Easing.Linear.None,!0);switch(a.direction){case Direction.NORTH:a.animations.play("walk_n",60,!0);break;case Direction.SOUTH:a.animations.play("walk_s", -60,!0);break;case Direction.EAST:a.animations.play("walk_e",60,!0);break;case Direction.WEST:a.animations.play("walk_w",60,!0)}b.onComplete.add(function(){a.animations.stop();a.updateDirection();a.isoX=Util.getIsoX(a.tileX);a.isoY=Util.getIsoY(a.tileY);a.onTileExit();for(var b=0;b