Updated Phaser to 2.11, Added magnetic tile sprite

This commit is contained in:
Simon 2018-11-27 12:50:18 -05:00
parent 1435d31d36
commit e848fd8b8a
6 changed files with 8376 additions and 7544 deletions

File diff suppressed because it is too large Load Diff

Binary file not shown.

Before

Width:  |  Height:  |  Size: 686 KiB

After

Width:  |  Height:  |  Size: 581 KiB

View File

@ -269,6 +269,7 @@ var config = {
wallTint: 0xDDDDDD,
vaultWallTint: 0x3F2D2A,
vaultFloorTint: 0x2B1E1C,
fluidTint: 0x0ACED6,
oreTint: 0xF3F3F3,
cubotHoverTint: 0x00FF00,
cubotTint: 0xFFFFFF,
@ -285,6 +286,7 @@ var config = {
hologramStroke: "#12FFB0",
copperFill: "#C87D38",
plainSprite: "tiles/tile",
magneticSprite: "tiles/magneticTile",
wallSprite: "tiles/bigTile",
wallSprite2: "tiles/bigTile2",
walkDuration: 800,
@ -1436,6 +1438,7 @@ var TileType;
TileType[TileType["VAULT_FLOOR"] = 4] = "VAULT_FLOOR";
TileType[TileType["VAULT_WALL"] = 5] = "VAULT_WALL";
TileType[TileType["FLUID"] = 6] = "FLUID";
TileType[TileType["MAGNETIC"] = 7] = "MAGNETIC";
})(TileType || (TileType = {}));
var Tile = (function (_super) {
__extends(Tile, _super);
@ -1463,6 +1466,8 @@ var Tile = (function (_super) {
return new VoidTile(x, y);
case TileType.FLUID:
return new FluidTile(x, y);
case TileType.MAGNETIC:
return new MagneticTile(x, y);
case TileType.PLAIN:
default:
return new PlainTile(x, y);
@ -1562,7 +1567,7 @@ var FluidTile = (function (_super) {
__extends(FluidTile, _super);
function FluidTile(x, y) {
var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
_this.baseTint = 0x0ACED6;
_this.baseTint = config.fluidTint;
_this.tint = _this.baseTint;
_this.alpha = 0.6;
_this.baseZ = -15;
@ -1572,6 +1577,26 @@ var FluidTile = (function (_super) {
}
return FluidTile;
}(Tile));
var MagneticTile = (function (_super) {
__extends(MagneticTile, _super);
function MagneticTile(x, y) {
var _this = _super.call(this, x, y, config.magneticSprite, 0) || this;
_this.baseTint = 0xFFFFFF;
_this.tint = _this.baseTint;
_this.setText("Magnetic", config.textIron);
_this.tileType = "Magnetic tile";
return _this;
}
MagneticTile.prototype.onHover = function () {
mar.game.add.tween(this).to({isoZ: this.baseZ + 30}, 200, Phaser.Easing.Quadratic.InOut, true);
mar.tileIndicator.tileX = this.tileX;
mar.tileIndicator.tileY = this.tileY;
mar.tileIndicator.tileType = this.tileType;
};
return MagneticTile;
}(Tile));
var IronTile = (function (_super) {
__extends(IronTile, _super);
function IronTile(x, y) {

File diff suppressed because it is too large Load Diff

View File

@ -16,7 +16,8 @@ enum TileType {
COPPER,
VAULT_FLOOR,
VAULT_WALL,
FLUID
FLUID,
MAGNETIC
}
class Tile extends Phaser.Plugin.Isometric.IsoSprite {
@ -73,6 +74,8 @@ class Tile extends Phaser.Plugin.Isometric.IsoSprite {
return new VoidTile(x, y);
case TileType.FLUID:
return new FluidTile(x, y);
case TileType.MAGNETIC:
return new MagneticTile(x, y);
case TileType.PLAIN:
default:
return new PlainTile(x, y);
@ -164,6 +167,7 @@ class VaultFloorTile extends Tile {
class VoidTile extends Tile {
public onHover() {
//don't do animation
mar.tileIndicator.tileX = this.tileX;
mar.tileIndicator.tileY = this.tileY;
mar.tileIndicator.tileType = this.tileType;
@ -185,17 +189,37 @@ class FluidTile extends Tile {
constructor(x: number, y: number) {
super(x, y, config.plainSprite, 0);
this.baseTint = 0x0ACED6;
this.baseTint = config.fluidTint;
this.tint = this.baseTint;
this.alpha = 0.6;
this.baseZ = -15;
this.isoZ = this.baseZ;
this.tileType = "fluid";
}
}
class MagneticTile extends Tile {
public onHover() {
mar.game.add.tween(this).to({isoZ: this.baseZ + 30}, 200, Phaser.Easing.Quadratic.InOut, true);
mar.tileIndicator.tileX = this.tileX;
mar.tileIndicator.tileY = this.tileY;
mar.tileIndicator.tileType = this.tileType;
}
constructor(x: number, y: number) {
super(x, y, config.magneticSprite, 0);
this.baseTint = 0xFFFFFF;
this.tint = this.baseTint;
this.setText("Magnetic", config.textIron);
this.tileType = "Magnetic tile";
}
}
class IronTile extends Tile {
constructor(x: number, y: number) {

View File

@ -11,6 +11,7 @@ let config = {
wallTint: 0xDDDDDD,
vaultWallTint: 0x3F2D2A,
vaultFloorTint: 0x2B1E1C,
fluidTint: 0x0ACED6,
oreTint: 0xF3F3F3,
cubotHoverTint: 0x00FF00,
cubotTint: 0xFFFFFF,
@ -27,6 +28,7 @@ let config = {
hologramStroke: "#12FFB0",
copperFill: "#C87D38",
plainSprite: "tiles/tile",
magneticSprite: "tiles/magneticTile",
wallSprite: "tiles/bigTile",
wallSprite2: "tiles/bigTile2",
walkDuration: 800, //walk animation duration in ms