Fixes flickering problem

This commit is contained in:
simon 2018-03-10 14:33:42 -05:00
parent 1d3dcc1fda
commit cac4b4ae89
3 changed files with 43 additions and 41 deletions

View File

@ -145,6 +145,8 @@ class Cubot extends GameObject {
//workaround for topological sort, needs sprite dimensions //workaround for topological sort, needs sprite dimensions
super(Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/blankCubot"); super(Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/blankCubot");
this.anchor.setTo(0.5, 0);
if (DEBUG) { if (DEBUG) {
console.log("Creating Cubot object"); console.log("Creating Cubot object");
} }
@ -257,8 +259,7 @@ class Cubot extends GameObject {
this.laserEmitter.maxAngle = angle; this.laserEmitter.maxAngle = angle;
this.laserEmitter.maxRotation = 0; this.laserEmitter.maxRotation = 0;
this.laserEmitter.start(true, 1000, null, 3);
this.laserEmitter.start(true, 1000, null, 100);
} }
public getTint(): number { public getTint(): number {

View File

@ -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;
@ -319,7 +319,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
@ -363,7 +363,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) {
@ -439,7 +439,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;
@ -470,7 +470,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 () {
@ -486,7 +486,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 () {
@ -508,7 +508,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 () {
@ -527,7 +527,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 () {
@ -549,7 +549,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 () {
@ -606,7 +606,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 () {
@ -617,7 +617,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 () {
@ -628,7 +628,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 () {
@ -639,7 +639,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();
@ -852,7 +852,7 @@ var Action;
Action[Action["JUMPING"] = 6] = "JUMPING"; Action[Action["JUMPING"] = 6] = "JUMPING";
Action[Action["ATTACKING"] = 7] = "ATTACKING"; Action[Action["ATTACKING"] = 7] = "ATTACKING";
})(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;
@ -913,7 +913,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 = var _this =
@ -924,6 +924,7 @@ var Cubot = /** @class */ (function (_super) {
*/ */
_this.queuedAnimations = []; _this.queuedAnimations = [];
_this.hovered = false; _this.hovered = false;
_this.anchor.setTo(0.5, 0);
if (DEBUG) { if (DEBUG) {
console.log("Creating Cubot object"); console.log("Creating Cubot object");
} }
@ -1011,7 +1012,7 @@ var Cubot = /** @class */ (function (_super) {
this.laserEmitter.minAngle = angle; this.laserEmitter.minAngle = angle;
this.laserEmitter.maxAngle = angle; this.laserEmitter.maxAngle = angle;
this.laserEmitter.maxRotation = 0; this.laserEmitter.maxRotation = 0;
this.laserEmitter.start(true, 1000, null, 100); this.laserEmitter.start(true, 1000, null, 3);
}; };
Cubot.prototype.getTint = function () { Cubot.prototype.getTint = function () {
if (!this.hovered) { if (!this.hovered) {
@ -1223,7 +1224,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;
@ -1283,7 +1284,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;
@ -1322,7 +1323,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;
@ -1358,7 +1359,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;
@ -1389,7 +1390,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;
@ -1421,7 +1422,7 @@ var VaultDoor = /** @class */ (function (_super) {
}; };
return VaultDoor; return VaultDoor;
}(GameObject)); }(GameObject));
var ElectricBox = /** @class */ (function (_super) { var ElectricBox = (function (_super) {
__extends(ElectricBox, _super); __extends(ElectricBox, _super);
function ElectricBox(json) { function ElectricBox(json) {
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/ElectricBox") || this; var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/ElectricBox") || this;
@ -1464,7 +1465,7 @@ var ElectricBox = /** @class */ (function (_super) {
}; };
return ElectricBox; return ElectricBox;
}(GameObject)); }(GameObject));
var Portal = /** @class */ (function (_super) { var Portal = (function (_super) {
__extends(Portal, _super); __extends(Portal, _super);
function Portal(json) { function Portal(json) {
var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/Portal") || this; var _this = _super.call(this, Util.getIsoX(json.x), Util.getIsoY(json.y), 15, "sheet", "objects/Portal") || this;
@ -1514,7 +1515,7 @@ var TileType;
TileType[TileType["VAULT_FLOOR"] = 4] = "VAULT_FLOOR"; TileType[TileType["VAULT_FLOOR"] = 4] = "VAULT_FLOOR";
TileType[TileType["VAULT_WALL"] = 5] = "VAULT_WALL"; 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;
@ -1575,7 +1576,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;
@ -1586,7 +1587,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;
@ -1597,7 +1598,7 @@ var WallTile = /** @class */ (function (_super) {
} }
return WallTile; return WallTile;
}(Tile)); }(Tile));
var VaultWallTile = /** @class */ (function (_super) { var VaultWallTile = (function (_super) {
__extends(VaultWallTile, _super); __extends(VaultWallTile, _super);
function VaultWallTile(x, y) { function VaultWallTile(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;
@ -1608,7 +1609,7 @@ var VaultWallTile = /** @class */ (function (_super) {
} }
return VaultWallTile; return VaultWallTile;
}(Tile)); }(Tile));
var VaultFloorTile = /** @class */ (function (_super) { var VaultFloorTile = (function (_super) {
__extends(VaultFloorTile, _super); __extends(VaultFloorTile, _super);
function VaultFloorTile(x, y) { function VaultFloorTile(x, y) {
var _this = _super.call(this, x, y, config.plainSprite, 0) || this; var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
@ -1619,7 +1620,7 @@ var VaultFloorTile = /** @class */ (function (_super) {
} }
return VaultFloorTile; return VaultFloorTile;
}(Tile)); }(Tile));
var VoidTile = /** @class */ (function (_super) { var VoidTile = (function (_super) {
__extends(VoidTile, _super); __extends(VoidTile, _super);
function VoidTile(x, y) { function VoidTile(x, y) {
var _this = _super.call(this, x, y, config.plainSprite, 0) || this; var _this = _super.call(this, x, y, config.plainSprite, 0) || this;
@ -1637,7 +1638,7 @@ var VoidTile = /** @class */ (function (_super) {
}; };
return VoidTile; return VoidTile;
}(Tile)); }(Tile));
var IronTile = /** @class */ (function (_super) { 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;
@ -1649,7 +1650,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;
@ -1661,7 +1662,7 @@ 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 = [];
@ -1805,7 +1806,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;
@ -1853,14 +1854,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;

View File

@ -4525,6 +4525,6 @@
"format": "RGBA8888", "format": "RGBA8888",
"size": {"w":3968,"h":1287}, "size": {"w":3968,"h":1287},
"scale": "1", "scale": "1",
"smartupdate": "$TexturePacker:SmartUpdate:26e43f2e555af7a52e29e0323d2ce9fe:b50bb10586fe68411afe3638bbc6b839:1eabdf11f75e3a4fe3147baf7b5be24b$" "smartupdate": "$TexturePacker:SmartUpdate:0b1af3f11d6034c4c4b1fd0e646ab6fe:64a6224c65ab69311cd6076a38e973c3:1eabdf11f75e3a4fe3147baf7b5be24b$"
} }
} }