mirror of
https://github.com/simon987/Much-Assembly-Required-Frontend.git
synced 2025-04-18 02:06:42 +00:00
v1.3a update
This commit is contained in:
parent
3e74d1264d
commit
69b7c7c455
@ -23,9 +23,24 @@ var colorScheme = {
|
||||
};
|
||||
|
||||
var mar = {};
|
||||
mar.objects = [];
|
||||
mar.animationFrames = {};
|
||||
|
||||
CUBOT_WALK_FRAMES = {
|
||||
south: 240,
|
||||
north: 194,
|
||||
west: 254,
|
||||
east: 164
|
||||
};
|
||||
|
||||
HARVESTER_WALK_FRAMES = {
|
||||
south: 347,
|
||||
north: 317,
|
||||
west: 377,
|
||||
east: 287
|
||||
};
|
||||
|
||||
|
||||
|
||||
if (fullscreen) {
|
||||
RENDERER_WIDTH = window.innerWidth - 4;
|
||||
RENDERER_HEIGHT = window.innerHeight - 4;
|
||||
@ -63,8 +78,6 @@ function dispatchTileEnter(x, y) {
|
||||
* Transparent, X: Normal, C: Cubot
|
||||
*/
|
||||
|
||||
console.log("enter " + x + ", " + y);
|
||||
|
||||
for (var i = 0; i < mar.world.tiles.length; i++) {
|
||||
|
||||
var tX = mar.world.tiles[i].tileX;
|
||||
@ -168,6 +181,8 @@ function Word(terrain) {
|
||||
|
||||
this.setTerrain(terrain);
|
||||
game.iso.topologicalSort(isoGroup);
|
||||
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
@ -199,7 +214,7 @@ function Word(terrain) {
|
||||
for (var i = 0; i < response.length; i++) {
|
||||
|
||||
//Update/Create the object
|
||||
var existingObject = self.getObject(response[i].id);
|
||||
var existingObject = self.getObject(response[i].i);
|
||||
|
||||
|
||||
if (existingObject !== null) {
|
||||
@ -236,28 +251,23 @@ function updateGameObject(object, responseObj) {
|
||||
object.direction = responseObj.direction;
|
||||
|
||||
|
||||
if (object.type === 1 || object.type === 10) {
|
||||
|
||||
console.log(responseObj.holo);
|
||||
if (object.type === 1) {
|
||||
|
||||
object.action = responseObj.action;
|
||||
|
||||
//Update location
|
||||
if ((object.tileX !== responseObj.x || object.tileY !== responseObj.y)) {
|
||||
//location changed
|
||||
console.log("walk");
|
||||
dispatchTileLeave(object.tileX, object.tileY);
|
||||
|
||||
object.tileX = responseObj.x;
|
||||
object.tileY = responseObj.y;
|
||||
cubotWalk(object, object.direction);
|
||||
cubotWalk(object, object.direction, undefined, CUBOT_WALK_FRAMES);
|
||||
}
|
||||
|
||||
//Update Inventory
|
||||
if (object.heldItem !== responseObj.heldItem) {
|
||||
|
||||
console.log("Update held item" + responseObj.heldItem);
|
||||
|
||||
if (object.inventory !== undefined) {
|
||||
object.inventory.destroy();
|
||||
}
|
||||
@ -307,6 +317,34 @@ function updateGameObject(object, responseObj) {
|
||||
//Dig
|
||||
cubotDig(object, object.direction);
|
||||
}
|
||||
} else if (object.type === 10) {
|
||||
object.action = responseObj.action;
|
||||
|
||||
//Update location
|
||||
if ((object.tileX !== responseObj.x || object.tileY !== responseObj.y)) {
|
||||
//location changed
|
||||
dispatchTileLeave(object.tileX, object.tileY);
|
||||
|
||||
object.tileX = responseObj.x;
|
||||
object.tileY = responseObj.y;
|
||||
cubotWalk(object, object.direction, undefined, HARVESTER_WALK_FRAMES);
|
||||
}
|
||||
|
||||
//Update direction
|
||||
switch (object.direction) {
|
||||
case DIR_NORTH:
|
||||
object.animations.frame = HARVESTER_WALK_FRAMES.north;
|
||||
break;
|
||||
case DIR_EAST:
|
||||
object.animations.frame = HARVESTER_WALK_FRAMES.east;
|
||||
break;
|
||||
case DIR_SOUTH:
|
||||
object.animations.frame = HARVESTER_WALK_FRAMES.south;
|
||||
break;
|
||||
case DIR_WEST:
|
||||
object.animations.frame = HARVESTER_WALK_FRAMES.west;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -361,9 +399,7 @@ function createInventory(items) {
|
||||
|
||||
function createGameObject(objData) {
|
||||
|
||||
console.log("Added " + objData.type);
|
||||
|
||||
if (objData.type === 1 || objData.type === 10) {
|
||||
if (objData.t === 1) {
|
||||
var cubot = game.add.isoSprite(getIsoX(objData.x), getIsoY(objData.y), 15, "sheet", null, isoGroup);
|
||||
cubot.anchor.set(0.5, 0);
|
||||
|
||||
@ -379,7 +415,7 @@ function createGameObject(objData) {
|
||||
document.body.style.cursor = 'default';
|
||||
});
|
||||
|
||||
cubot.id = objData.id;
|
||||
cubot.id = objData.i;
|
||||
cubot.type = 1;
|
||||
cubot.tileX = objData.x;
|
||||
cubot.tileY = objData.y;
|
||||
@ -393,6 +429,10 @@ function createGameObject(objData) {
|
||||
|
||||
dispatchTileEnter(objData.x, objData.y);
|
||||
|
||||
cubot.isAt = function (x, y) {
|
||||
return this.tileX === x && this.tileY === y;
|
||||
};
|
||||
|
||||
cubot.onTileHover = function () {
|
||||
game.add.tween(this).to({isoZ: 45}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
game.add.tween(this.scale).to({x: 1.2, y: 1.2}, 200, Phaser.Easing.Linear.None, true);
|
||||
@ -462,9 +502,7 @@ function createGameObject(objData) {
|
||||
|
||||
return cubot;
|
||||
|
||||
} else if (objData.type === 2) {
|
||||
|
||||
console.log("biomass");
|
||||
} else if (objData.t === 2) {
|
||||
|
||||
var biomass = game.add.isoSprite(getIsoX(objData.x), getIsoY(objData.y), 10, "sheet", 1, isoGroup);
|
||||
biomass.animations.add("idle", mar.animationFrames.biomassIdle, true);
|
||||
@ -473,7 +511,7 @@ function createGameObject(objData) {
|
||||
biomass.type = 2;
|
||||
biomass.tileX = objData.x;
|
||||
biomass.tileY = objData.y;
|
||||
biomass.id = objData.id;
|
||||
biomass.id = objData.i;
|
||||
|
||||
biomass.tint = colorScheme.biomassTint;// "#3BB886"
|
||||
|
||||
@ -488,7 +526,16 @@ function createGameObject(objData) {
|
||||
biomass.hoverText.anchor.set(0.5, 0);
|
||||
biomass.addChild(biomass.hoverText);
|
||||
|
||||
biomass.isAt = function (x, y) {
|
||||
return this.tileX === x && this.tileY === y;
|
||||
};
|
||||
|
||||
biomass.isAt = function (x, y) {
|
||||
return this.tileX === x && this.tileY === y;
|
||||
};
|
||||
|
||||
biomass.onTileHover = function () {
|
||||
game.tweens.removeFrom(this);
|
||||
document.body.style.cursor = 'pointer';
|
||||
game.add.tween(this).to({isoZ: 45}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
this.tint = colorScheme.biomassHoverTint;
|
||||
@ -499,6 +546,7 @@ function createGameObject(objData) {
|
||||
|
||||
};
|
||||
biomass.onTileOut = function () {
|
||||
game.tweens.removeFrom(this);
|
||||
document.body.style.cursor = 'default';
|
||||
|
||||
game.add.tween(this).to({isoZ: 15}, 400, Phaser.Easing.Bounce.Out, true);
|
||||
@ -510,6 +558,105 @@ function createGameObject(objData) {
|
||||
biomass.animations.play("idle", 45, true);
|
||||
|
||||
return biomass;
|
||||
|
||||
} else if (objData.t === 10) {
|
||||
|
||||
var harvester = game.add.isoSprite(getIsoX(objData.x), getIsoY(objData.y), 15, "sheet", null, isoGroup);
|
||||
harvester.anchor.set(0.5, 0);
|
||||
|
||||
harvester.id = objData.i;
|
||||
harvester.type = 10;
|
||||
harvester.tileX = objData.x;
|
||||
harvester.tileY = objData.y;
|
||||
harvester.direction = objData.direction;
|
||||
harvester.action = objData.action;
|
||||
|
||||
dispatchTileEnter(objData.x, objData.y);
|
||||
|
||||
harvester.isAt = function (x, y) {
|
||||
return this.tileX === x && this.tileY === y;
|
||||
};
|
||||
|
||||
harvester.onTileHover = function () {
|
||||
game.add.tween(this).to({isoZ: 45}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
game.add.tween(this.scale).to({x: 1.2, y: 1.2}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = colorScheme.cubotHoverTint;
|
||||
};
|
||||
harvester.onTileOut = function () {
|
||||
game.add.tween(this).to({isoZ: 15}, 400, Phaser.Easing.Bounce.Out, true);
|
||||
game.add.tween(this.scale).to({x: 1, y: 1}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = colorScheme.cubotTint;
|
||||
};
|
||||
|
||||
harvester.animations.add("walk_w", mar.animationFrames.harvester_walk_w, true);
|
||||
harvester.animations.add("walk_s", mar.animationFrames.harvester_walk_s, true);
|
||||
harvester.animations.add("walk_e", mar.animationFrames.harvester_walk_e, true);
|
||||
harvester.animations.add("walk_n", mar.animationFrames.harvester_walk_n, true);
|
||||
|
||||
harvester.queuedAnims = [];
|
||||
|
||||
switch (harvester.direction) {
|
||||
case DIR_NORTH:
|
||||
harvester.animations.frame = HARVESTER_WALK_FRAMES.north;
|
||||
break;
|
||||
case DIR_EAST:
|
||||
harvester.animations.frame = HARVESTER_WALK_FRAMES.east;
|
||||
break;
|
||||
case DIR_SOUTH:
|
||||
harvester.animations.frame = HARVESTER_WALK_FRAMES.south;
|
||||
break;
|
||||
case DIR_WEST:
|
||||
harvester.animations.frame = HARVESTER_WALK_FRAMES.west;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
return harvester;
|
||||
} else if (objData.t === 3) {
|
||||
//Factory
|
||||
var factory = game.add.isoSprite(getIsoX(objData.x), getIsoY(objData.y), 15, "sheet", "objects/factory", isoGroup);
|
||||
factory.anchor.set(0.5, .25);
|
||||
|
||||
factory.id = objData.i;
|
||||
factory.type = 3;
|
||||
factory.tileX = objData.x;
|
||||
factory.tileY = objData.y;
|
||||
|
||||
|
||||
factory.hoverText = game.make.text(0, 0, "Factory", {
|
||||
fontSize: 22,
|
||||
fill: colorScheme.textFill,
|
||||
stroke: colorScheme.textStroke,
|
||||
strokeThickness: 2,
|
||||
font: "fixedsys"
|
||||
});
|
||||
factory.hoverText.alpha = 0;
|
||||
factory.hoverText.anchor.set(0.5, 0);
|
||||
factory.addChild(factory.hoverText);
|
||||
|
||||
factory.isAt = function (x, y) {
|
||||
return (this.tileX === x || this.tileX + 1 === x) && (this.tileY + 1 === y || this.tileY === y);
|
||||
};
|
||||
|
||||
factory.onTileHover = function () {
|
||||
game.tweens.removeFrom(this);
|
||||
game.add.tween(this).to({isoZ: 25}, 200, Phaser.Easing.Quadratic.InOut, true);
|
||||
game.add.tween(this.scale).to({x: 1.06, y: 1.06}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = colorScheme.cubotHoverTint;
|
||||
|
||||
game.add.tween(this.hoverText).to({alpha: 0.9}, 200, Phaser.Easing.Quadratic.In, true);
|
||||
factory.hoverText.visible = true;
|
||||
};
|
||||
factory.onTileOut = function () {
|
||||
game.tweens.removeFrom(this);
|
||||
game.add.tween(this).to({isoZ: 15}, 400, Phaser.Easing.Bounce.Out, true);
|
||||
game.add.tween(this.scale).to({x: 1, y: 1}, 200, Phaser.Easing.Linear.None, true);
|
||||
this.tint = colorScheme.cubotTint;
|
||||
|
||||
game.add.tween(this.hoverText).to({alpha: 0}, 200, Phaser.Easing.Quadratic.Out, true);
|
||||
};
|
||||
|
||||
return factory;
|
||||
}
|
||||
}
|
||||
|
||||
@ -589,9 +736,6 @@ function objectListener(message) {
|
||||
|
||||
if (message.t === "object") {
|
||||
mar.world.updateObjects(message.objects);
|
||||
|
||||
console.log(message.objects);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -664,6 +808,7 @@ var GameClient = function (callback) {
|
||||
var message = JSON.parse(received.data);
|
||||
|
||||
} catch (e) {
|
||||
console.log(e)
|
||||
floppyListener(received);
|
||||
}
|
||||
|
||||
@ -707,7 +852,6 @@ var GameClient = function (callback) {
|
||||
};
|
||||
|
||||
this.requestTerrain = function () {
|
||||
console.log("request terrain");
|
||||
this.socket.send(JSON.stringify({t: "terrain", x: mar.worldX, y: mar.worldY}));
|
||||
};
|
||||
|
||||
@ -749,7 +893,7 @@ function dispatchTileHover(x, y) {
|
||||
|
||||
var object = mar.world.objects[i];
|
||||
|
||||
if (object.tileX === x && object.tileY === y) {
|
||||
if (object.isAt(x, y)) {
|
||||
object.onTileHover();
|
||||
}
|
||||
}
|
||||
@ -760,7 +904,7 @@ function dispatchTileOut(x, y) {
|
||||
|
||||
var object = mar.world.objects[i];
|
||||
|
||||
if (object.tileX === x && object.tileY === y) {
|
||||
if (object.isAt(x, y)) {
|
||||
object.onTileOut();
|
||||
}
|
||||
}
|
||||
@ -868,6 +1012,17 @@ BasicGame.Boot.prototype = {
|
||||
if (count % 10 === 0) {
|
||||
game.iso.topologicalSort(isoGroup);
|
||||
}
|
||||
|
||||
|
||||
// if(mar.world){
|
||||
// for(var i = 0; i < mar.world.objects.length; i++){
|
||||
// if(mar.world.objects[i].animations){
|
||||
// console.log(mar.world.objects[i].animations.currentFrame)
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
},
|
||||
|
||||
|
||||
@ -997,13 +1152,14 @@ function cubotDig(cubot, direction, callback) {
|
||||
}
|
||||
}
|
||||
|
||||
function cubotWalk(cubot, direction, callback) {
|
||||
function cubotWalk(cubot, direction, callback, walkFrames) {
|
||||
|
||||
var tween;
|
||||
|
||||
if (direction === DIR_SOUTH) {
|
||||
|
||||
var walk = function (duration) {
|
||||
|
||||
cubot.animations.play("walk_s", 60, true);
|
||||
tween = game.add.tween(cubot).to({isoX: getIsoX(cubot.tileX), isoY: getIsoY(cubot.tileY)},
|
||||
duration, Phaser.Easing.Linear.None, true);
|
||||
@ -1012,7 +1168,7 @@ function cubotWalk(cubot, direction, callback) {
|
||||
|
||||
tween.onComplete.add(function () {
|
||||
cubot.animations.stop();
|
||||
cubot.animations.frame = 240;
|
||||
cubot.animations.frame = walkFrames.south;
|
||||
// cubot.tileY++;
|
||||
cubot.onTileOut();
|
||||
//Resync position
|
||||
@ -1033,6 +1189,7 @@ function cubotWalk(cubot, direction, callback) {
|
||||
} else if (direction === DIR_NORTH) {
|
||||
|
||||
walk = function (duration) {
|
||||
|
||||
cubot.animations.play("walk_n", 60, true);
|
||||
tween = game.add.tween(cubot).to({isoX: getIsoX(cubot.tileX), isoY: getIsoY(cubot.tileY)},
|
||||
duration, Phaser.Easing.Linear.None, true);
|
||||
@ -1040,7 +1197,7 @@ function cubotWalk(cubot, direction, callback) {
|
||||
|
||||
tween.onComplete.add(function () {
|
||||
cubot.animations.stop();
|
||||
cubot.animations.frame = 194;
|
||||
cubot.animations.frame = walkFrames.north;
|
||||
// cubot.tileY--;
|
||||
cubot.onTileOut();
|
||||
//Resync position
|
||||
@ -1060,6 +1217,8 @@ function cubotWalk(cubot, direction, callback) {
|
||||
|
||||
} else if (direction === DIR_WEST) {
|
||||
walk = function (duration) {
|
||||
|
||||
|
||||
cubot.animations.play("walk_w", 60, true);
|
||||
tween = game.add.tween(cubot).to({isoX: getIsoX(cubot.tileX), isoY: getIsoY(cubot.tileY)},
|
||||
duration, Phaser.Easing.Linear.None, true);
|
||||
@ -1069,7 +1228,7 @@ function cubotWalk(cubot, direction, callback) {
|
||||
|
||||
tween.onComplete.add(function () {
|
||||
cubot.animations.stop();
|
||||
cubot.animations.frame = 254;
|
||||
cubot.animations.frame = walkFrames.west;
|
||||
// cubot.tileX--;
|
||||
cubot.onTileOut();
|
||||
//Resync position
|
||||
@ -1089,6 +1248,7 @@ function cubotWalk(cubot, direction, callback) {
|
||||
|
||||
} else if (direction === DIR_EAST) {
|
||||
walk = function (duration) {
|
||||
|
||||
cubot.animations.play("walk_e", 60, true);
|
||||
tween = game.add.tween(cubot).to({isoX: getIsoX(cubot.tileX), isoY: getIsoY(cubot.tileY)},
|
||||
duration, Phaser.Easing.Linear.None, true);
|
||||
@ -1098,7 +1258,7 @@ function cubotWalk(cubot, direction, callback) {
|
||||
|
||||
tween.onComplete.add(function () {
|
||||
cubot.animations.stop();
|
||||
cubot.animations.frame = 164;
|
||||
cubot.animations.frame = walkFrames.east;
|
||||
// cubot.tileX++;
|
||||
|
||||
cubot.onTileOut();
|
||||
@ -1141,6 +1301,15 @@ function initialiseAnimations() {
|
||||
for (i = 10; i < 30; i++) {
|
||||
mar.animationFrames.walk_e.push("cubot/walk_e/" + ("0000" + i).slice(-4));
|
||||
}
|
||||
|
||||
mar.animationFrames.harvester_walk_e_start = [];
|
||||
for (var i = 0; i < 10; i++) {
|
||||
mar.animationFrames.harvester_walk_e_start.push("harvester/walk_e/" + ("0000" + i).slice(-4));
|
||||
}
|
||||
mar.animationFrames.harvester_walk_e = [];
|
||||
for (i = 10; i < 30; i++) {
|
||||
mar.animationFrames.harvester_walk_e.push("harvester/walk_e/" + ("0000" + i).slice(-4));
|
||||
}
|
||||
//North
|
||||
mar.animationFrames.walk_n_start = [];
|
||||
for (i = 0; i < 10; i++) {
|
||||
@ -1150,6 +1319,15 @@ function initialiseAnimations() {
|
||||
for (i = 10; i < 30; i++) {
|
||||
mar.animationFrames.walk_n.push("cubot/walk_n/" + ("0000" + i).slice(-4));
|
||||
}
|
||||
|
||||
mar.animationFrames.harvester_walk_n_start = [];
|
||||
for (i = 0; i < 10; i++) {
|
||||
mar.animationFrames.harvester_walk_n_start.push("harvester/walk_n/" + ("0000" + i).slice(-4));
|
||||
}
|
||||
mar.animationFrames.harvester_walk_n = [];
|
||||
for (i = 10; i < 30; i++) {
|
||||
mar.animationFrames.harvester_walk_n.push("harvester/walk_n/" + ("0000" + i).slice(-4));
|
||||
}
|
||||
//South
|
||||
mar.animationFrames.walk_s_start = [];
|
||||
for (i = 0; i < 10; i++) {
|
||||
@ -1159,6 +1337,15 @@ function initialiseAnimations() {
|
||||
for (i = 10; i < 30; i++) {
|
||||
mar.animationFrames.walk_s.push("cubot/walk_s/" + ("0000" + i).slice(-4));
|
||||
}
|
||||
|
||||
mar.animationFrames.harvester_walk_s_start = [];
|
||||
for (i = 0; i < 10; i++) {
|
||||
mar.animationFrames.harvester_walk_s_start.push("harvester/walk_s/" + ("0000" + i).slice(-4));
|
||||
}
|
||||
mar.animationFrames.harvester_walk_s = [];
|
||||
for (i = 10; i < 30; i++) {
|
||||
mar.animationFrames.harvester_walk_s.push("harvester/walk_s/" + ("0000" + i).slice(-4));
|
||||
}
|
||||
//West
|
||||
mar.animationFrames.walk_w_start = [];
|
||||
for (i = 0; i < 10; i++) {
|
||||
@ -1169,6 +1356,15 @@ function initialiseAnimations() {
|
||||
mar.animationFrames.walk_w.push("cubot/walk_w/" + ("0000" + i).slice(-4));
|
||||
}
|
||||
|
||||
mar.animationFrames.harvester_walk_w_start = [];
|
||||
for (i = 0; i < 10; i++) {
|
||||
mar.animationFrames.harvester_walk_w_start.push("harvester/walk_w/" + ("0000" + i).slice(-4));
|
||||
}
|
||||
mar.animationFrames.harvester_walk_w = [];
|
||||
for (i = 10; i < 30; i++) {
|
||||
mar.animationFrames.harvester_walk_w.push("harvester/walk_w/" + ("0000" + i).slice(-4));
|
||||
}
|
||||
|
||||
//Dig =-------------------------------------------------------
|
||||
mar.animationFrames.dig_e = [];
|
||||
for (i = 1; i <= 41; i++) {
|
||||
|
77
mar/phaser/mar.min.js
vendored
77
mar/phaser/mar.min.js
vendored
@ -1,43 +1,50 @@
|
||||
DIR_NORTH=0;DIR_EAST=1;DIR_SOUTH=2;DIR_WEST=3;WORLD_HEIGHT=WORLD_WIDTH=16;var colorScheme={tileTint:16777215,wallTint:14540253,cubotHoverTint:65280,cubotTint:16777215,textFill:"#FFFFFF",textStroke:"#9298a8",biomassTint:6535263,biomassHoverTint:65280,tileHoverTint:65280,itemIron:4408129,itemCopper:13139256,hologramFill:"#FFFFFF",hologramStroke:"#9298a8",hologramAlpha:.9},mar={objects:[],animationFrames:{}};
|
||||
fullscreen?(RENDERER_WIDTH=window.innerWidth-4,RENDERER_HEIGHT=window.innerHeight-4):(RENDERER_WIDTH=document.getElementById("game").clientWidth,RENDERER_HEIGHT=window.innerHeight/1.25);var game=new Phaser.Game(RENDERER_WIDTH,RENDERER_HEIGHT,Phaser.AUTO,"game",null,!0,!1);
|
||||
function dispatchTileLeave(a,b){for(var d=0;d<mar.world.tiles.length;d++){var c=mar.world.tiles[d].tileX,f=mar.world.tiles[d].tileY;mar.world.tiles[d].isWall&&(c===a&&f-1===b||c-1===a&&f-1===b||c-1===a&&f===b)&&1!==mar.world.tiles[d].alpha&&game.add.tween(mar.world.tiles[d]).to({alpha:1},175,Phaser.Easing.Quadratic.In,!0)}}
|
||||
function dispatchTileEnter(a,b){console.log("enter "+a+", "+b);for(var d=0;d<mar.world.tiles.length;d++){var c=mar.world.tiles[d].tileX,f=mar.world.tiles[d].tileY;mar.world.tiles[d].isWall&&(c===a&&f-1===b||c-1===a&&f-1===b||c-1===a&&f===b)&&game.add.tween(mar.world.tiles[d]).to({alpha:.6},300,Phaser.Easing.Quadratic.In,!0)}}
|
||||
function Word(a){var b=this;b.tiles=[];b.objects=[];setupWorldArrows();this.setTerrain=function(a){for(var c=0;c<WORLD_HEIGHT;c++)for(var d=0;d<WORLD_HEIGHT;d++){var e=a[d*WORLD_WIDTH+c];if(1===e)e=game.add.isoSprite(getIsoX(c),getIsoY(d),0,"sheet","tiles/bigTile",isoGroup),e.baseZ=0,e.baseTint=colorScheme.wallTint,e.anchor.set(.5,.2),e.isWall=!0;else{if(2===e)e=game.add.isoSprite(getIsoX(c),getIsoY(d),0,"sheet","tiles/tile",isoGroup),g=game.make.text(0,16,"Iron",{fontSize:22,fill:"#434341",stroke:"#FFFFFF",
|
||||
strokeThickness:1,font:"fixedsys"}),g.alpha=.6,g.anchor.set(.5,0),e.addChild(g),e.baseZ=0,e.baseTint=15987699;else if(3===e){e=game.add.isoSprite(getIsoX(c),getIsoY(d),0,"sheet","tiles/tile",isoGroup);var g=game.make.text(0,16,"Copper",{fontSize:22,fill:"#C87D38",stroke:"#FFFFFF",strokeThickness:1,font:"fixedsys"});g.alpha=.6;g.anchor.set(.5,0);e.addChild(g);e.baseZ=0;e.baseTint=15987699}else e=game.add.isoSprite(getIsoX(c),getIsoY(d),0,"sheet","tiles/tile",isoGroup),e.baseZ=0,e.baseTint=colorScheme.tileTint;
|
||||
e.anchor.set(.5,0)}e.isTile=!0;e.tileX=c;e.tileY=d;e.tint=e.baseTint;b.tiles.push(e)}};this.setTerrain(a);this.update=function(a){for(var b=0;b<mar.world.objects.length;b++)mar.world.objects[b].destroy();for(b=0;b<mar.world.tiles.length;b++)mar.world.tiles[b].destroy();mar.world.objects=[];mar.world.tiles=[];this.setTerrain(a);game.iso.topologicalSort(isoGroup)};this.getObject=function(a){for(var c=0;c<b.objects.length;c++)if(b.objects[c].id===a)return b.objects[c];return null};this.updateObjects=
|
||||
function(a){for(c=0;c<b.objects.length;c++)b.objects[c].updated=!1;for(var c=0;c<a.length;c++){var d=b.getObject(a[c].id);null!==d?(d.updated=!0,updateGameObject(d,a[c])):(d=createGameObject(a[c]),d.updated=!0,b.objects.push(d))}for(c=0;c<b.objects.length;c++)b.objects[c].updated||(b.objects[c].destroy(),b.objects.splice(c,1))}}
|
||||
function updateGameObject(a,b){a.direction=b.direction;if(1===a.type||10===a.type){console.log(b.holo);a.action=b.action;if(a.tileX!==b.x||a.tileY!==b.y)console.log("walk"),dispatchTileLeave(a.tileX,a.tileY),a.tileX=b.x,a.tileY=b.y,cubotWalk(a,a.direction);a.heldItem!==b.heldItem&&(console.log("Update held item"+b.heldItem),void 0!==a.inventory&&a.inventory.destroy(),a.inventory=createInventory([b.heldItem]),a.addChild(a.inventory),a.heldItem=b.heldItem);switch(a.direction){case DIR_NORTH:a.animations.frame=
|
||||
194;break;case DIR_EAST:a.animations.frame=164;break;case DIR_SOUTH:a.animations.frame=240;break;case DIR_WEST:a.animations.frame=254}void 0!==a.hologram&&a.hologram.destroy();0!==b.holo&&(a.hologram=game.make.text(0,32,"0x"+("0000"+Number(b.holo).toString(16).toUpperCase()).slice(-4),{fontSize:32,fill:colorScheme.hologramFill,stroke:colorScheme.hologramStroke,strokeThickness:1,font:"fixedsys"}),a.hologram.alpha=colorScheme.hologramAlpha,a.hologram.anchor.set(.5,0),a.addChild(a.hologram));1===a.action&&
|
||||
cubotDig(a,a.direction)}}function itemColor(a){switch(a){case 1:return colorScheme.biomassTint;case 3:return colorScheme.itemIron;case 4:return colorScheme.itemCopper}}
|
||||
function createInventory(a){var b=game.make.group();switch(a.length){case 0:return b;case 1:if(0!==a[0]){var d=game.make.sprite(0,0,"sheet","inventory/inv1x1");d.anchor.set(.5,.1);d.alpha=.5;var c=game.make.sprite(0,0,"sheet","inventory/item");c.anchor.set(.5,.1);c.tint=itemColor(a[0]);b.addChild(d);b.addChild(c)}return b}for(b=0;b<a.length;b++);}
|
||||
function createGameObject(a){console.log("Added "+a.type);if(1===a.type||10===a.type){var b=game.add.isoSprite(getIsoX(a.x),getIsoY(a.y),15,"sheet",null,isoGroup);b.anchor.set(.5,0);b.inputEnabled=!0;b.events.onInputDown.add(function(){debugObj="Cubot: "+b.tileX+", "+b.tileY});b.events.onInputOver.add(function(){document.body.style.cursor="pointer"});b.events.onInputOut.add(function(){document.body.style.cursor="default"});b.id=a.id;b.type=1;b.tileX=a.x;b.tileY=a.y;b.username=a.parent;b.heldItem=
|
||||
a.heldItem;b.direction=a.direction;b.action=a.action;b.inventory=createInventory([b.heldItem]);b.addChild(b.inventory);dispatchTileEnter(a.x,a.y);b.onTileHover=function(){game.add.tween(this).to({isoZ:45},200,Phaser.Easing.Quadratic.InOut,!0);game.add.tween(this.scale).to({x:1.2,y:1.2},200,Phaser.Easing.Linear.None,!0);this.tint=colorScheme.cubotHoverTint};b.onTileOut=function(){document.body.style.cursor="default";game.add.tween(this).to({isoZ:15},400,Phaser.Easing.Bounce.Out,!0);game.add.tween(this.scale).to({x:1,
|
||||
DIR_NORTH=0;DIR_EAST=1;DIR_SOUTH=2;DIR_WEST=3;WORLD_HEIGHT=WORLD_WIDTH=16;var colorScheme={tileTint:16777215,wallTint:14540253,cubotHoverTint:65280,cubotTint:16777215,textFill:"#FFFFFF",textStroke:"#9298a8",biomassTint:6535263,biomassHoverTint:65280,tileHoverTint:65280,itemIron:4408129,itemCopper:13139256,hologramFill:"#FFFFFF",hologramStroke:"#9298a8",hologramAlpha:.9},mar={animationFrames:{}};CUBOT_WALK_FRAMES={south:240,north:194,west:254,east:164};
|
||||
HARVESTER_WALK_FRAMES={south:347,north:317,west:377,east:287};fullscreen?(RENDERER_WIDTH=window.innerWidth-4,RENDERER_HEIGHT=window.innerHeight-4):(RENDERER_WIDTH=document.getElementById("game").clientWidth,RENDERER_HEIGHT=window.innerHeight/1.25);var game=new Phaser.Game(RENDERER_WIDTH,RENDERER_HEIGHT,Phaser.AUTO,"game",null,!0,!1);
|
||||
function dispatchTileLeave(a,b){for(var c=0;c<mar.world.tiles.length;c++){var d=mar.world.tiles[c].tileX,e=mar.world.tiles[c].tileY;mar.world.tiles[c].isWall&&(d===a&&e-1===b||d-1===a&&e-1===b||d-1===a&&e===b)&&1!==mar.world.tiles[c].alpha&&game.add.tween(mar.world.tiles[c]).to({alpha:1},175,Phaser.Easing.Quadratic.In,!0)}}
|
||||
function dispatchTileEnter(a,b){for(var c=0;c<mar.world.tiles.length;c++){var d=mar.world.tiles[c].tileX,e=mar.world.tiles[c].tileY;mar.world.tiles[c].isWall&&(d===a&&e-1===b||d-1===a&&e-1===b||d-1===a&&e===b)&&game.add.tween(mar.world.tiles[c]).to({alpha:.6},300,Phaser.Easing.Quadratic.In,!0)}}
|
||||
function Word(a){var b=this;b.tiles=[];b.objects=[];setupWorldArrows();this.setTerrain=function(a){for(var d=0;d<WORLD_HEIGHT;d++)for(var c=0;c<WORLD_HEIGHT;c++){var f=a[c*WORLD_WIDTH+d];if(1===f)f=game.add.isoSprite(getIsoX(d),getIsoY(c),0,"sheet","tiles/bigTile",isoGroup),f.baseZ=0,f.baseTint=colorScheme.wallTint,f.anchor.set(.5,.2),f.isWall=!0;else{if(2===f)f=game.add.isoSprite(getIsoX(d),getIsoY(c),0,"sheet","tiles/tile",isoGroup),g=game.make.text(0,16,"Iron",{fontSize:22,fill:"#434341",stroke:"#FFFFFF",
|
||||
strokeThickness:1,font:"fixedsys"}),g.alpha=.6,g.anchor.set(.5,0),f.addChild(g),f.baseZ=0,f.baseTint=15987699;else if(3===f){f=game.add.isoSprite(getIsoX(d),getIsoY(c),0,"sheet","tiles/tile",isoGroup);var g=game.make.text(0,16,"Copper",{fontSize:22,fill:"#C87D38",stroke:"#FFFFFF",strokeThickness:1,font:"fixedsys"});g.alpha=.6;g.anchor.set(.5,0);f.addChild(g);f.baseZ=0;f.baseTint=15987699}else f=game.add.isoSprite(getIsoX(d),getIsoY(c),0,"sheet","tiles/tile",isoGroup),f.baseZ=0,f.baseTint=colorScheme.tileTint;
|
||||
f.anchor.set(.5,0)}f.isTile=!0;f.tileX=d;f.tileY=c;f.tint=f.baseTint;b.tiles.push(f)}};this.setTerrain(a);this.update=function(a){for(var b=0;b<mar.world.objects.length;b++)mar.world.objects[b].destroy();for(b=0;b<mar.world.tiles.length;b++)mar.world.tiles[b].destroy();mar.world.objects=[];mar.world.tiles=[];this.setTerrain(a);game.iso.topologicalSort(isoGroup)};this.getObject=function(a){for(var c=0;c<b.objects.length;c++)if(b.objects[c].id===a)return b.objects[c];return null};this.updateObjects=
|
||||
function(a){for(c=0;c<b.objects.length;c++)b.objects[c].updated=!1;for(var c=0;c<a.length;c++){var e=b.getObject(a[c].i);null!==e?(e.updated=!0,updateGameObject(e,a[c])):(e=createGameObject(a[c]),e.updated=!0,b.objects.push(e))}for(c=0;c<b.objects.length;c++)b.objects[c].updated||(b.objects[c].destroy(),b.objects.splice(c,1))}}
|
||||
function updateGameObject(a,b){a.direction=b.direction;if(1===a.type){a.action=b.action;if(a.tileX!==b.x||a.tileY!==b.y)dispatchTileLeave(a.tileX,a.tileY),a.tileX=b.x,a.tileY=b.y,cubotWalk(a,a.direction,void 0,CUBOT_WALK_FRAMES);a.heldItem!==b.heldItem&&(void 0!==a.inventory&&a.inventory.destroy(),a.inventory=createInventory([b.heldItem]),a.addChild(a.inventory),a.heldItem=b.heldItem);switch(a.direction){case DIR_NORTH:a.animations.frame=194;break;case DIR_EAST:a.animations.frame=164;break;case DIR_SOUTH:a.animations.frame=
|
||||
240;break;case DIR_WEST:a.animations.frame=254}void 0!==a.hologram&&a.hologram.destroy();0!==b.holo&&(a.hologram=game.make.text(0,32,"0x"+("0000"+Number(b.holo).toString(16).toUpperCase()).slice(-4),{fontSize:32,fill:colorScheme.hologramFill,stroke:colorScheme.hologramStroke,strokeThickness:1,font:"fixedsys"}),a.hologram.alpha=colorScheme.hologramAlpha,a.hologram.anchor.set(.5,0),a.addChild(a.hologram));1===a.action&&cubotDig(a,a.direction)}else if(10===a.type){a.action=b.action;if(a.tileX!==b.x||
|
||||
a.tileY!==b.y)dispatchTileLeave(a.tileX,a.tileY),a.tileX=b.x,a.tileY=b.y,cubotWalk(a,a.direction,void 0,HARVESTER_WALK_FRAMES);switch(a.direction){case DIR_NORTH:a.animations.frame=HARVESTER_WALK_FRAMES.north;break;case DIR_EAST:a.animations.frame=HARVESTER_WALK_FRAMES.east;break;case DIR_SOUTH:a.animations.frame=HARVESTER_WALK_FRAMES.south;break;case DIR_WEST:a.animations.frame=HARVESTER_WALK_FRAMES.west}}}
|
||||
function itemColor(a){switch(a){case 1:return colorScheme.biomassTint;case 3:return colorScheme.itemIron;case 4:return colorScheme.itemCopper}}function createInventory(a){var b=game.make.group();switch(a.length){case 0:return b;case 1:if(0!==a[0]){var c=game.make.sprite(0,0,"sheet","inventory/inv1x1");c.anchor.set(.5,.1);c.alpha=.5;var d=game.make.sprite(0,0,"sheet","inventory/item");d.anchor.set(.5,.1);d.tint=itemColor(a[0]);b.addChild(c);b.addChild(d)}return b}for(b=0;b<a.length;b++);}
|
||||
function createGameObject(a){if(1===a.t){var b=game.add.isoSprite(getIsoX(a.x),getIsoY(a.y),15,"sheet",null,isoGroup);b.anchor.set(.5,0);b.inputEnabled=!0;b.events.onInputDown.add(function(){debugObj="Cubot: "+b.tileX+", "+b.tileY});b.events.onInputOver.add(function(){document.body.style.cursor="pointer"});b.events.onInputOut.add(function(){document.body.style.cursor="default"});b.id=a.i;b.type=1;b.tileX=a.x;b.tileY=a.y;b.username=a.parent;b.heldItem=a.heldItem;b.direction=a.direction;b.action=a.action;
|
||||
b.inventory=createInventory([b.heldItem]);b.addChild(b.inventory);dispatchTileEnter(a.x,a.y);b.isAt=function(a,b){return this.tileX===a&&this.tileY===b};b.onTileHover=function(){game.add.tween(this).to({isoZ:45},200,Phaser.Easing.Quadratic.InOut,!0);game.add.tween(this.scale).to({x:1.2,y:1.2},200,Phaser.Easing.Linear.None,!0);this.tint=colorScheme.cubotHoverTint};b.onTileOut=function(){document.body.style.cursor="default";game.add.tween(this).to({isoZ:15},400,Phaser.Easing.Bounce.Out,!0);game.add.tween(this.scale).to({x:1,
|
||||
y:1},200,Phaser.Easing.Linear.None,!0);this.tint=colorScheme.cubotTint};b.animations.add("walk_w",mar.animationFrames.walk_w,!0);b.animations.add("walk_s",mar.animationFrames.walk_s,!0);b.animations.add("walk_e",mar.animationFrames.walk_e,!0);b.animations.add("walk_n",mar.animationFrames.walk_n,!0);b.animations.add("dig_w",mar.animationFrames.dig_w,!1);b.animations.add("dig_s",mar.animationFrames.dig_s,!1);b.animations.add("dig_e",mar.animationFrames.dig_e,!1);b.animations.add("dig_n",mar.animationFrames.dig_n,
|
||||
!1);b.queuedAnims=[];switch(b.direction){case DIR_NORTH:b.animations.frame=194;break;case DIR_EAST:b.animations.frame=164;break;case DIR_SOUTH:b.animations.frame=240;break;case DIR_WEST:b.animations.frame=254}var d=game.make.text(0,-24,b.username,{fontSize:22,fill:colorScheme.textFill,stroke:colorScheme.textStroke,strokeThickness:2,font:"fixedsys"});d.alpha=.85;d.anchor.set(.5,0);b.addChild(d);0!==a.holo&&(b.hologram=game.make.text(0,32,"0x"+("0000"+Number(a.holo).toString(16).toUpperCase()).slice(-4),
|
||||
{fontSize:32,fill:colorScheme.hologramFill,stroke:colorScheme.hologramStroke,strokeThickness:1,font:"fixedsys"}),b.hologram.alpha=colorScheme.hologramAlpha,b.hologram.anchor.set(.5,0),b.addChild(b.hologram));return b}if(2===a.type){console.log("biomass");var c=game.add.isoSprite(getIsoX(a.x),getIsoY(a.y),10,"sheet",1,isoGroup);c.animations.add("idle",mar.animationFrames.biomassIdle,!0);c.anchor.set(.5,0);c.type=2;c.tileX=a.x;c.tileY=a.y;c.id=a.id;c.tint=colorScheme.biomassTint;c.hoverText=game.make.text(0,
|
||||
0,"Biomass",{fontSize:22,fill:colorScheme.textFill,stroke:colorScheme.textStroke,strokeThickness:2,font:"fixedsys"});c.hoverText.alpha=0;c.hoverText.anchor.set(.5,0);c.addChild(c.hoverText);c.onTileHover=function(){document.body.style.cursor="pointer";game.add.tween(this).to({isoZ:45},200,Phaser.Easing.Quadratic.InOut,!0);this.tint=colorScheme.biomassHoverTint;game.add.tween(this.scale).to({x:1.2,y:1.2},200,Phaser.Easing.Linear.None,!0);game.add.tween(this.hoverText).to({alpha:.9},200,Phaser.Easing.Quadratic.In,
|
||||
!0);c.hoverText.visible=!0};c.onTileOut=function(){document.body.style.cursor="default";game.add.tween(this).to({isoZ:15},400,Phaser.Easing.Bounce.Out,!0);game.add.tween(this.scale).to({x:1,y:1},200,Phaser.Easing.Linear.None,!0);this.tint=colorScheme.biomassTint;game.add.tween(this.hoverText).to({alpha:0},200,Phaser.Easing.Quadratic.Out,!0)};c.animations.play("idle",45,!0);return c}}function manhanttanDistance(a,b,d,c){return Math.abs(a-d)+Math.abs(b-c)}
|
||||
function codeListener(a){"code"===a.t&&ace.edit("editor").setValue(a.code)}function authListener(a){"auth"===a.t&&("ok"===a.m?(console.log("Auth successful"),mar.client.requestUserInfo()):alert("Authentication failed. Please make sure you are logged in and reload the page."))}function codeResponseListener(a){"codeResponse"===a.t&&alert("Uploaded and assembled "+a.bytes+" bytes")}
|
||||
function userInfoListener(a){"userInfo"===a.t&&(console.log(a),mar.worldX=a.worldX,mar.worldY=a.worldY,mar.maxWidth=a.maxWidth,mar.client.requestTerrain())}function terrainListener(a){"terrain"===a.t&&(void 0!==mar.world?(mar.client.socket.send(JSON.stringify({t:"object",x:mar.worldX,y:mar.worldY})),mar.world.update(a.terrain)):(mar.world=new Word(a.terrain),console.log("Gameloop started")))}function objectListener(a){"object"===a.t&&(mar.world.updateObjects(a.objects),console.log(a.objects))}
|
||||
!1);b.queuedAnims=[];switch(b.direction){case DIR_NORTH:b.animations.frame=194;break;case DIR_EAST:b.animations.frame=164;break;case DIR_SOUTH:b.animations.frame=240;break;case DIR_WEST:b.animations.frame=254}var c=game.make.text(0,-24,b.username,{fontSize:22,fill:colorScheme.textFill,stroke:colorScheme.textStroke,strokeThickness:2,font:"fixedsys"});c.alpha=.85;c.anchor.set(.5,0);b.addChild(c);0!==a.holo&&(b.hologram=game.make.text(0,32,"0x"+("0000"+Number(a.holo).toString(16).toUpperCase()).slice(-4),
|
||||
{fontSize:32,fill:colorScheme.hologramFill,stroke:colorScheme.hologramStroke,strokeThickness:1,font:"fixedsys"}),b.hologram.alpha=colorScheme.hologramAlpha,b.hologram.anchor.set(.5,0),b.addChild(b.hologram));return b}if(2===a.t){var d=game.add.isoSprite(getIsoX(a.x),getIsoY(a.y),10,"sheet",1,isoGroup);d.animations.add("idle",mar.animationFrames.biomassIdle,!0);d.anchor.set(.5,0);d.type=2;d.tileX=a.x;d.tileY=a.y;d.id=a.i;d.tint=colorScheme.biomassTint;d.hoverText=game.make.text(0,0,"Biomass",{fontSize:22,
|
||||
fill:colorScheme.textFill,stroke:colorScheme.textStroke,strokeThickness:2,font:"fixedsys"});d.hoverText.alpha=0;d.hoverText.anchor.set(.5,0);d.addChild(d.hoverText);d.isAt=function(a,b){return this.tileX===a&&this.tileY===b};d.isAt=function(a,b){return this.tileX===a&&this.tileY===b};d.onTileHover=function(){game.tweens.removeFrom(this);document.body.style.cursor="pointer";game.add.tween(this).to({isoZ:45},200,Phaser.Easing.Quadratic.InOut,!0);this.tint=colorScheme.biomassHoverTint;game.add.tween(this.scale).to({x:1.2,
|
||||
y:1.2},200,Phaser.Easing.Linear.None,!0);game.add.tween(this.hoverText).to({alpha:.9},200,Phaser.Easing.Quadratic.In,!0);d.hoverText.visible=!0};d.onTileOut=function(){game.tweens.removeFrom(this);document.body.style.cursor="default";game.add.tween(this).to({isoZ:15},400,Phaser.Easing.Bounce.Out,!0);game.add.tween(this.scale).to({x:1,y:1},200,Phaser.Easing.Linear.None,!0);this.tint=colorScheme.biomassTint;game.add.tween(this.hoverText).to({alpha:0},200,Phaser.Easing.Quadratic.Out,!0)};d.animations.play("idle",
|
||||
45,!0);return d}if(10===a.t){c=game.add.isoSprite(getIsoX(a.x),getIsoY(a.y),15,"sheet",null,isoGroup);c.anchor.set(.5,0);c.id=a.i;c.type=10;c.tileX=a.x;c.tileY=a.y;c.direction=a.direction;c.action=a.action;dispatchTileEnter(a.x,a.y);c.isAt=function(a,b){return this.tileX===a&&this.tileY===b};c.onTileHover=function(){game.add.tween(this).to({isoZ:45},200,Phaser.Easing.Quadratic.InOut,!0);game.add.tween(this.scale).to({x:1.2,y:1.2},200,Phaser.Easing.Linear.None,!0);this.tint=colorScheme.cubotHoverTint};
|
||||
c.onTileOut=function(){game.add.tween(this).to({isoZ:15},400,Phaser.Easing.Bounce.Out,!0);game.add.tween(this.scale).to({x:1,y:1},200,Phaser.Easing.Linear.None,!0);this.tint=colorScheme.cubotTint};c.animations.add("walk_w",mar.animationFrames.harvester_walk_w,!0);c.animations.add("walk_s",mar.animationFrames.harvester_walk_s,!0);c.animations.add("walk_e",mar.animationFrames.harvester_walk_e,!0);c.animations.add("walk_n",mar.animationFrames.harvester_walk_n,!0);c.queuedAnims=[];switch(c.direction){case DIR_NORTH:c.animations.frame=
|
||||
HARVESTER_WALK_FRAMES.north;break;case DIR_EAST:c.animations.frame=HARVESTER_WALK_FRAMES.east;break;case DIR_SOUTH:c.animations.frame=HARVESTER_WALK_FRAMES.south;break;case DIR_WEST:c.animations.frame=HARVESTER_WALK_FRAMES.west}return c}if(3===a.t){var e=game.add.isoSprite(getIsoX(a.x),getIsoY(a.y),15,"sheet","objects/factory",isoGroup);e.anchor.set(.5,.25);e.id=a.i;e.type=3;e.tileX=a.x;e.tileY=a.y;e.hoverText=game.make.text(0,0,"Factory",{fontSize:22,fill:colorScheme.textFill,stroke:colorScheme.textStroke,
|
||||
strokeThickness:2,font:"fixedsys"});e.hoverText.alpha=0;e.hoverText.anchor.set(.5,0);e.addChild(e.hoverText);e.isAt=function(a,b){return(this.tileX===a||this.tileX+1===a)&&(this.tileY+1===b||this.tileY===b)};e.onTileHover=function(){game.tweens.removeFrom(this);game.add.tween(this).to({isoZ:25},200,Phaser.Easing.Quadratic.InOut,!0);game.add.tween(this.scale).to({x:1.06,y:1.06},200,Phaser.Easing.Linear.None,!0);this.tint=colorScheme.cubotHoverTint;game.add.tween(this.hoverText).to({alpha:.9},200,Phaser.Easing.Quadratic.In,
|
||||
!0);e.hoverText.visible=!0};e.onTileOut=function(){game.tweens.removeFrom(this);game.add.tween(this).to({isoZ:15},400,Phaser.Easing.Bounce.Out,!0);game.add.tween(this.scale).to({x:1,y:1},200,Phaser.Easing.Linear.None,!0);this.tint=colorScheme.cubotTint;game.add.tween(this.hoverText).to({alpha:0},200,Phaser.Easing.Quadratic.Out,!0)};return e}}function manhanttanDistance(a,b,c,d){return Math.abs(a-c)+Math.abs(b-d)}function codeListener(a){"code"===a.t&&ace.edit("editor").setValue(a.code)}
|
||||
function authListener(a){"auth"===a.t&&("ok"===a.m?(console.log("Auth successful"),mar.client.requestUserInfo()):alert("Authentication failed. Please make sure you are logged in and reload the page."))}function codeResponseListener(a){"codeResponse"===a.t&&alert("Uploaded and assembled "+a.bytes+" bytes")}function userInfoListener(a){"userInfo"===a.t&&(console.log(a),mar.worldX=a.worldX,mar.worldY=a.worldY,mar.maxWidth=a.maxWidth,mar.client.requestTerrain())}
|
||||
function terrainListener(a){"terrain"===a.t&&(void 0!==mar.world?(mar.client.socket.send(JSON.stringify({t:"object",x:mar.worldX,y:mar.worldY})),mar.world.update(a.terrain)):(mar.world=new Word(a.terrain),console.log("Gameloop started")))}function objectListener(a){"object"===a.t&&mar.world.updateObjects(a.objects)}
|
||||
function floppyListener(a){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")}function tickListener(a){"tick"===a.t&&mar.client.socket.send(JSON.stringify({t:"object",x:mar.worldX,y:mar.worldY}))}
|
||||
var GameClient=function(a){var b=this,d=[],c=new XMLHttpRequest;c.open("GET","./getServerInfo.php",!0);c.onreadystatechange=function(){4===c.readyState&&200===c.status&&(console.log("Received server info "+c.responseText),setTimeout(function(){var f=JSON.parse(c.responseText);console.log(f.address);b.socket=new WebSocket(f.address);b.username=f.username;b.tickLength=f.tickLength;b.serverName=f.serverName;mar.client.socket.binaryType="arraybuffer";b.socket.onopen=function(){b.socket.send(f.token);
|
||||
d.push(authListener);d.push(userInfoListener);d.push(terrainListener);d.push(tickListener);d.push(objectListener);d.push(codeListener);d.push(codeResponseListener);mar.client.socket.onmessage=function(a){try{var b=JSON.parse(a.data)}catch(h){floppyListener(a)}for(a=0;a<d.length;a++)d[a](b)};b.reloadCode();void 0!==a&&a()};b.socket.onerror=function(a){alert("Can't connect to game server at address "+f.address);console.log(a)};b.socket.onclose=function(a){alert("Disconnected from server");console.log(a)}},
|
||||
100))};c.send(null);this.requestUserInfo=function(){this.socket.send(JSON.stringify({t:"userInfo"}))};this.requestTerrain=function(){console.log("request terrain");this.socket.send(JSON.stringify({t:"terrain",x:mar.worldX,y:mar.worldY}))};this.uploadCode=function(a){console.log("Uploaded code");this.socket.send(JSON.stringify({t:"uploadCode",code:a}))};this.reloadCode=function(){this.socket.send(JSON.stringify({t:"codeRequest"}))};this.sendKeypress=function(a){0!==a&&this.socket.send(JSON.stringify({t:"k",
|
||||
k:a}))};this.request=function(a){0!==a&&this.socket.send(JSON.stringify({t:"k",k:a}))};this.requestFloppy=function(){document.getElementById("floppyDown").innerHTML='<i class="fa fa-cog fa-spin fa-fw"></i>';this.socket.send(JSON.stringify({t:"floppyDown"}))};this.notifyFloppyUp=function(){this.socket.send(JSON.stringify({t:"floppyUp"}))}};function dispatchTileHover(a,b){for(var d in mar.world.objects){var c=mar.world.objects[d];if(c.tileX===a&&c.tileY===b)c.onTileHover()}}
|
||||
function dispatchTileOut(a,b){for(var d in mar.world.objects){var c=mar.world.objects[d];if(c.tileX===a&&c.tileY===b)c.onTileOut()}}var count=0,BasicGame=function(a){};BasicGame.Boot=function(a){};var isoGroup,cursorPos,cursor,debugTile,debugObj,objectsGroup,cursors,tmpLine;
|
||||
var GameClient=function(a){var b=this,c=[],d=new XMLHttpRequest;d.open("GET","./getServerInfo.php",!0);d.onreadystatechange=function(){4===d.readyState&&200===d.status&&(console.log("Received server info "+d.responseText),setTimeout(function(){var e=JSON.parse(d.responseText);console.log(e.address);b.socket=new WebSocket(e.address);b.username=e.username;b.tickLength=e.tickLength;b.serverName=e.serverName;mar.client.socket.binaryType="arraybuffer";b.socket.onopen=function(){b.socket.send(e.token);
|
||||
c.push(authListener);c.push(userInfoListener);c.push(terrainListener);c.push(tickListener);c.push(objectListener);c.push(codeListener);c.push(codeResponseListener);mar.client.socket.onmessage=function(a){try{var b=JSON.parse(a.data)}catch(h){console.log(h),floppyListener(a)}for(a=0;a<c.length;a++)c[a](b)};b.reloadCode();void 0!==a&&a()};b.socket.onerror=function(a){alert("Can't connect to game server at address "+e.address);console.log(a)};b.socket.onclose=function(a){alert("Disconnected from server");
|
||||
console.log(a)}},100))};d.send(null);this.requestUserInfo=function(){this.socket.send(JSON.stringify({t:"userInfo"}))};this.requestTerrain=function(){this.socket.send(JSON.stringify({t:"terrain",x:mar.worldX,y:mar.worldY}))};this.uploadCode=function(a){console.log("Uploaded code");this.socket.send(JSON.stringify({t:"uploadCode",code:a}))};this.reloadCode=function(){this.socket.send(JSON.stringify({t:"codeRequest"}))};this.sendKeypress=function(a){0!==a&&this.socket.send(JSON.stringify({t:"k",k:a}))};
|
||||
this.request=function(a){0!==a&&this.socket.send(JSON.stringify({t:"k",k:a}))};this.requestFloppy=function(){document.getElementById("floppyDown").innerHTML='<i class="fa fa-cog fa-spin fa-fw"></i>';this.socket.send(JSON.stringify({t:"floppyDown"}))};this.notifyFloppyUp=function(){this.socket.send(JSON.stringify({t:"floppyUp"}))}};function dispatchTileHover(a,b){for(var c in mar.world.objects){var d=mar.world.objects[c];if(d.isAt(a,b))d.onTileHover()}}
|
||||
function dispatchTileOut(a,b){for(var c in mar.world.objects){var d=mar.world.objects[c];if(d.isAt(a,b))d.onTileOut()}}var count=0,BasicGame=function(a){};BasicGame.Boot=function(a){};var isoGroup,cursorPos,cursor,debugTile,debugObj,objectsGroup,cursors,tmpLine;
|
||||
BasicGame.Boot.prototype={preload:function(){game.load.atlasJSONHash("sheet","./mar/sprites.png","./mar/sprites.json");game.time.advancedTiming=!0;game.plugins.add(new Phaser.Plugin.Isometric(game));game.iso.anchor.setTo(.5,0);game.world.setBounds(0,0,2200,1100);game.camera.x=280;game.camera.y=90;game.stage.disableVisibilityChange=!0},create:function(){isoGroup=game.add.group();objectsGroup=game.add.group();initialiseAnimations();this.spawnTiles();cursorPos=new Phaser.Plugin.Isometric.Point3;cursors=
|
||||
game.input.keyboard.createCursorKeys()},update:function(){game.iso.unproject(game.input.activePointer.position,cursorPos);isoGroup.forEach(function(a){if(a.isTile){var b=a.isoBounds.containsXY(cursorPos.x,cursorPos.y);!a.selected&&b?(a.selected=!0,a.tint=colorScheme.tileHoverTint,debugTile=a.tileX+", "+a.tileY,dispatchTileHover(a.tileX,a.tileY),game.add.tween(a).to({isoZ:a.baseZ+8},200,Phaser.Easing.Quadratic.InOut,!0)):a.selected&&!b&&(dispatchTileOut(a.tileX,a.tileY),a.selected=!1,a.tint=a.baseTint,
|
||||
game.add.tween(a).to({isoZ:a.baseZ},200,Phaser.Easing.Quadratic.InOut,!0))}});this.game.input.activePointer.isDown?(this.game.origDragPoint&&(this.game.camera.x+=this.game.origDragPoint.x-this.game.input.activePointer.position.x,this.game.camera.y+=this.game.origDragPoint.y-this.game.input.activePointer.position.y),this.game.origDragPoint=this.game.input.activePointer.position.clone()):this.game.origDragPoint=null;count++;0===count%10&&game.iso.topologicalSort(isoGroup)},render:function(){void 0!==
|
||||
mar.worldX?game.debug.text("World: ("+Number(mar.worldX).toString(16)+", "+Number(mar.worldY).toString(16)+")",10,20):game.debug.text("World: (?,?)",10,20);debugTile&&game.debug.text(debugTile,10,40);void 0!==tmpLine&&(game.debug.geom(tmpLine),game.debug.lineInfo(tmpLine,32,32))},spawnTiles:function(){mar.client=new GameClient}};
|
||||
function setupWorldArrows(){var a=game.make.isoSprite(528,-10,10,"sheet","ui/arrow_north",isoGroup);a.inputEnabled=!0;a.events.onInputDown.add(function(){0===mar.worldY?mar.worldY=mar.maxWidth:mar.worldY--;mar.client.requestTerrain()});a.events.onInputOver.add(function(){a.tint=65280;document.body.style.cursor="pointer"});a.events.onInputOut.add(function(){a.tint=16777215;document.body.style.cursor="default"});isoGroup.addChild(a);var b=game.make.isoSprite(1115,587,10,"sheet","ui/arrow_east",isoGroup);
|
||||
b.inputEnabled=!0;b.events.onInputDown.add(function(){mar.worldX===mar.maxWidth?mar.worldX=0:mar.worldX++;mar.client.requestTerrain()});b.events.onInputOver.add(function(){b.tint=65280;document.body.style.cursor="pointer"});b.events.onInputOut.add(function(){b.tint=16777215;document.body.style.cursor="default"});isoGroup.addChild(b);var d=game.make.isoSprite(528,1170,10,"sheet","ui/arrow_south",isoGroup);d.inputEnabled=!0;d.events.onInputDown.add(function(){mar.worldY===mar.maxWidth?mar.worldY=0:
|
||||
mar.worldY++;mar.client.requestTerrain()});d.events.onInputOver.add(function(){d.tint=65280;document.body.style.cursor="pointer"});d.events.onInputOut.add(function(){d.tint=16777215;document.body.style.cursor="default"});isoGroup.addChild(d);var c=game.make.isoSprite(-60,587,10,"sheet","ui/arrow_west",isoGroup);c.inputEnabled=!0;c.events.onInputDown.add(function(){0===mar.worldX?mar.worldX=mar.maxWidth:mar.worldX--;mar.client.requestTerrain()});c.events.onInputOver.add(function(){c.tint=65280;document.body.style.cursor=
|
||||
"pointer"});c.events.onInputOut.add(function(){c.tint=16777215;document.body.style.cursor="default"});isoGroup.addChild(c)}function cubotDig(a,b,d){b===DIR_NORTH?a.animations.play("dig_n",45):b===DIR_EAST?a.animations.play("dig_e",45):b===DIR_SOUTH?a.animations.play("dig_s",45):b===DIR_WEST&&a.animations.play("dig_w",45)}
|
||||
function cubotWalk(a,b,d){var c;if(b===DIR_SOUTH)var f=function(b){a.animations.play("walk_s",60,!0);c=game.add.tween(a).to({isoX:getIsoX(a.tileX),isoY:getIsoY(a.tileY)},b,Phaser.Easing.Linear.None,!0);dispatchTileEnter(a.tileX,a.tileY);c.onComplete.add(function(){a.animations.stop();a.animations.frame=240;a.onTileOut();a.isoX=getIsoX(a.tileX);a.isoY=getIsoY(a.tileY);void 0!==d&&d();for(var b=0;b<a.queuedAnims.length;b++)a.queuedAnims[b](500),a.queuedAnims.splice(b,1)})};else b===DIR_NORTH?f=function(b){a.animations.play("walk_n",
|
||||
60,!0);c=game.add.tween(a).to({isoX:getIsoX(a.tileX),isoY:getIsoY(a.tileY)},b,Phaser.Easing.Linear.None,!0);dispatchTileEnter(a.tileX,a.tileY);c.onComplete.add(function(){a.animations.stop();a.animations.frame=194;a.onTileOut();a.isoX=getIsoX(a.tileX);a.isoY=getIsoY(a.tileY);void 0!==d&&d();for(var b=0;b<a.queuedAnims.length;b++)a.queuedAnims[b](500),a.queuedAnims.splice(b,1)})}:b===DIR_WEST?f=function(b){a.animations.play("walk_w",60,!0);c=game.add.tween(a).to({isoX:getIsoX(a.tileX),isoY:getIsoY(a.tileY)},
|
||||
b,Phaser.Easing.Linear.None,!0);dispatchTileEnter(a.tileX,a.tileY);c.onComplete.add(function(){a.animations.stop();a.animations.frame=254;a.onTileOut();a.isoX=getIsoX(a.tileX);a.isoY=getIsoY(a.tileY);void 0!==d&&d();for(var b=0;b<a.queuedAnims.length;b++)a.queuedAnims[b](500),a.queuedAnims.splice(b,1)})}:b===DIR_EAST&&(f=function(b){a.animations.play("walk_e",60,!0);c=game.add.tween(a).to({isoX:getIsoX(a.tileX),isoY:getIsoY(a.tileY)},b,Phaser.Easing.Linear.None,!0);dispatchTileEnter(a.tileX,a.tileY);
|
||||
c.onComplete.add(function(){a.animations.stop();a.animations.frame=164;a.onTileOut();a.isoX=getIsoX(a.tileX);a.isoY=getIsoY(a.tileY);void 0!==d&&d();for(var b=0;b<a.queuedAnims.length;b++)a.queuedAnims[b](500),a.queuedAnims.splice(b,1)})});a.animations.currentAnim.isPlaying?(a.queuedAnims.push(f),console.log("Queued Animation")):f(800)}
|
||||
function initialiseAnimations(){mar.animationFrames.walk_e_start=[];for(var a=0;10>a;a++)mar.animationFrames.walk_e_start.push("cubot/walk_e/"+("0000"+a).slice(-4));mar.animationFrames.walk_e=[];for(a=10;30>a;a++)mar.animationFrames.walk_e.push("cubot/walk_e/"+("0000"+a).slice(-4));mar.animationFrames.walk_n_start=[];for(a=0;10>a;a++)mar.animationFrames.walk_n_start.push("cubot/walk_n/"+("0000"+a).slice(-4));mar.animationFrames.walk_n=[];for(a=10;30>a;a++)mar.animationFrames.walk_n.push("cubot/walk_n/"+
|
||||
("0000"+a).slice(-4));mar.animationFrames.walk_s_start=[];for(a=0;10>a;a++)mar.animationFrames.walk_s_start.push("cubot/walk_s/"+("0000"+a).slice(-4));mar.animationFrames.walk_s=[];for(a=10;30>a;a++)mar.animationFrames.walk_s.push("cubot/walk_s/"+("0000"+a).slice(-4));mar.animationFrames.walk_w_start=[];for(a=0;10>a;a++)mar.animationFrames.walk_w_start.push("cubot/walk_w/"+("0000"+a).slice(-4));mar.animationFrames.walk_w=[];for(a=10;30>a;a++)mar.animationFrames.walk_w.push("cubot/walk_w/"+("0000"+
|
||||
a).slice(-4));mar.animationFrames.dig_e=[];for(a=1;41>=a;a++)mar.animationFrames.dig_e.push("cubot/dig_e/"+("0000"+a).slice(-4));mar.animationFrames.dig_n=[];for(a=1;41>=a;a++)mar.animationFrames.dig_n.push("cubot/dig_n/"+("0000"+a).slice(-4));mar.animationFrames.dig_s=[];for(a=1;41>=a;a++)mar.animationFrames.dig_s.push("cubot/dig_s/"+("0000"+a).slice(-4));mar.animationFrames.dig_w=[];for(a=1;41>=a;a++)mar.animationFrames.dig_w.push("cubot/dig_w/"+("0000"+a).slice(-4));mar.animationFrames.biomassIdle=
|
||||
b.inputEnabled=!0;b.events.onInputDown.add(function(){mar.worldX===mar.maxWidth?mar.worldX=0:mar.worldX++;mar.client.requestTerrain()});b.events.onInputOver.add(function(){b.tint=65280;document.body.style.cursor="pointer"});b.events.onInputOut.add(function(){b.tint=16777215;document.body.style.cursor="default"});isoGroup.addChild(b);var c=game.make.isoSprite(528,1170,10,"sheet","ui/arrow_south",isoGroup);c.inputEnabled=!0;c.events.onInputDown.add(function(){mar.worldY===mar.maxWidth?mar.worldY=0:
|
||||
mar.worldY++;mar.client.requestTerrain()});c.events.onInputOver.add(function(){c.tint=65280;document.body.style.cursor="pointer"});c.events.onInputOut.add(function(){c.tint=16777215;document.body.style.cursor="default"});isoGroup.addChild(c);var d=game.make.isoSprite(-60,587,10,"sheet","ui/arrow_west",isoGroup);d.inputEnabled=!0;d.events.onInputDown.add(function(){0===mar.worldX?mar.worldX=mar.maxWidth:mar.worldX--;mar.client.requestTerrain()});d.events.onInputOver.add(function(){d.tint=65280;document.body.style.cursor=
|
||||
"pointer"});d.events.onInputOut.add(function(){d.tint=16777215;document.body.style.cursor="default"});isoGroup.addChild(d)}function cubotDig(a,b,c){b===DIR_NORTH?a.animations.play("dig_n",45):b===DIR_EAST?a.animations.play("dig_e",45):b===DIR_SOUTH?a.animations.play("dig_s",45):b===DIR_WEST&&a.animations.play("dig_w",45)}
|
||||
function cubotWalk(a,b,c,d){var e;if(b===DIR_SOUTH)var f=function(b){a.animations.play("walk_s",60,!0);e=game.add.tween(a).to({isoX:getIsoX(a.tileX),isoY:getIsoY(a.tileY)},b,Phaser.Easing.Linear.None,!0);dispatchTileEnter(a.tileX,a.tileY);e.onComplete.add(function(){a.animations.stop();a.animations.frame=d.south;a.onTileOut();a.isoX=getIsoX(a.tileX);a.isoY=getIsoY(a.tileY);void 0!==c&&c();for(var b=0;b<a.queuedAnims.length;b++)a.queuedAnims[b](500),a.queuedAnims.splice(b,1)})};else b===DIR_NORTH?
|
||||
f=function(b){a.animations.play("walk_n",60,!0);e=game.add.tween(a).to({isoX:getIsoX(a.tileX),isoY:getIsoY(a.tileY)},b,Phaser.Easing.Linear.None,!0);dispatchTileEnter(a.tileX,a.tileY);e.onComplete.add(function(){a.animations.stop();a.animations.frame=d.north;a.onTileOut();a.isoX=getIsoX(a.tileX);a.isoY=getIsoY(a.tileY);void 0!==c&&c();for(var b=0;b<a.queuedAnims.length;b++)a.queuedAnims[b](500),a.queuedAnims.splice(b,1)})}:b===DIR_WEST?f=function(b){a.animations.play("walk_w",60,!0);e=game.add.tween(a).to({isoX:getIsoX(a.tileX),
|
||||
isoY:getIsoY(a.tileY)},b,Phaser.Easing.Linear.None,!0);dispatchTileEnter(a.tileX,a.tileY);e.onComplete.add(function(){a.animations.stop();a.animations.frame=d.west;a.onTileOut();a.isoX=getIsoX(a.tileX);a.isoY=getIsoY(a.tileY);void 0!==c&&c();for(var b=0;b<a.queuedAnims.length;b++)a.queuedAnims[b](500),a.queuedAnims.splice(b,1)})}:b===DIR_EAST&&(f=function(b){a.animations.play("walk_e",60,!0);e=game.add.tween(a).to({isoX:getIsoX(a.tileX),isoY:getIsoY(a.tileY)},b,Phaser.Easing.Linear.None,!0);dispatchTileEnter(a.tileX,
|
||||
a.tileY);e.onComplete.add(function(){a.animations.stop();a.animations.frame=d.east;a.onTileOut();a.isoX=getIsoX(a.tileX);a.isoY=getIsoY(a.tileY);void 0!==c&&c();for(var b=0;b<a.queuedAnims.length;b++)a.queuedAnims[b](500),a.queuedAnims.splice(b,1)})});a.animations.currentAnim.isPlaying?(a.queuedAnims.push(f),console.log("Queued Animation")):f(800)}
|
||||
function initialiseAnimations(){mar.animationFrames.walk_e_start=[];for(var a=0;10>a;a++)mar.animationFrames.walk_e_start.push("cubot/walk_e/"+("0000"+a).slice(-4));mar.animationFrames.walk_e=[];for(a=10;30>a;a++)mar.animationFrames.walk_e.push("cubot/walk_e/"+("0000"+a).slice(-4));mar.animationFrames.harvester_walk_e_start=[];for(a=0;10>a;a++)mar.animationFrames.harvester_walk_e_start.push("harvester/walk_e/"+("0000"+a).slice(-4));mar.animationFrames.harvester_walk_e=[];for(a=10;30>a;a++)mar.animationFrames.harvester_walk_e.push("harvester/walk_e/"+
|
||||
("0000"+a).slice(-4));mar.animationFrames.walk_n_start=[];for(a=0;10>a;a++)mar.animationFrames.walk_n_start.push("cubot/walk_n/"+("0000"+a).slice(-4));mar.animationFrames.walk_n=[];for(a=10;30>a;a++)mar.animationFrames.walk_n.push("cubot/walk_n/"+("0000"+a).slice(-4));mar.animationFrames.harvester_walk_n_start=[];for(a=0;10>a;a++)mar.animationFrames.harvester_walk_n_start.push("harvester/walk_n/"+("0000"+a).slice(-4));mar.animationFrames.harvester_walk_n=[];for(a=10;30>a;a++)mar.animationFrames.harvester_walk_n.push("harvester/walk_n/"+
|
||||
("0000"+a).slice(-4));mar.animationFrames.walk_s_start=[];for(a=0;10>a;a++)mar.animationFrames.walk_s_start.push("cubot/walk_s/"+("0000"+a).slice(-4));mar.animationFrames.walk_s=[];for(a=10;30>a;a++)mar.animationFrames.walk_s.push("cubot/walk_s/"+("0000"+a).slice(-4));mar.animationFrames.harvester_walk_s_start=[];for(a=0;10>a;a++)mar.animationFrames.harvester_walk_s_start.push("harvester/walk_s/"+("0000"+a).slice(-4));mar.animationFrames.harvester_walk_s=[];for(a=10;30>a;a++)mar.animationFrames.harvester_walk_s.push("harvester/walk_s/"+
|
||||
("0000"+a).slice(-4));mar.animationFrames.walk_w_start=[];for(a=0;10>a;a++)mar.animationFrames.walk_w_start.push("cubot/walk_w/"+("0000"+a).slice(-4));mar.animationFrames.walk_w=[];for(a=10;30>a;a++)mar.animationFrames.walk_w.push("cubot/walk_w/"+("0000"+a).slice(-4));mar.animationFrames.harvester_walk_w_start=[];for(a=0;10>a;a++)mar.animationFrames.harvester_walk_w_start.push("harvester/walk_w/"+("0000"+a).slice(-4));mar.animationFrames.harvester_walk_w=[];for(a=10;30>a;a++)mar.animationFrames.harvester_walk_w.push("harvester/walk_w/"+
|
||||
("0000"+a).slice(-4));mar.animationFrames.dig_e=[];for(a=1;41>=a;a++)mar.animationFrames.dig_e.push("cubot/dig_e/"+("0000"+a).slice(-4));mar.animationFrames.dig_n=[];for(a=1;41>=a;a++)mar.animationFrames.dig_n.push("cubot/dig_n/"+("0000"+a).slice(-4));mar.animationFrames.dig_s=[];for(a=1;41>=a;a++)mar.animationFrames.dig_s.push("cubot/dig_s/"+("0000"+a).slice(-4));mar.animationFrames.dig_w=[];for(a=1;41>=a;a++)mar.animationFrames.dig_w.push("cubot/dig_w/"+("0000"+a).slice(-4));mar.animationFrames.biomassIdle=
|
||||
[];for(a=1;60>a;a++)mar.animationFrames.biomassIdle.push("objects/biomass/idle/"+("0000"+a).slice(-4))}function getIsoX(a){return 71.5*a}function getIsoY(a){return 71.5*a}game.state.add("Boot",BasicGame.Boot);game.state.start("Boot");
|
||||
|
@ -4221,7 +4221,7 @@
|
||||
"sourceSize": {"w":128,"h":70},
|
||||
"pivot": {"x":0.5,"y":0.5}
|
||||
},
|
||||
"objects/digester":
|
||||
"objects/factory":
|
||||
{
|
||||
"frame": {"x":256,"y":1050,"w":256,"h":192},
|
||||
"rotated": false,
|
||||
@ -4435,6 +4435,6 @@
|
||||
"format": "RGBA8888",
|
||||
"size": {"w":3968,"h":1242},
|
||||
"scale": "1",
|
||||
"smartupdate": "$TexturePacker:SmartUpdate:fb0956e26464912927837fb79b171871:6d568b757362a9e9c0a2cdd8d421eebc:1eabdf11f75e3a4fe3147baf7b5be24b$"
|
||||
"smartupdate": "$TexturePacker:SmartUpdate:3e5e86b81265c9a25c883a4b788fcc48:d45ceb66196fa2f419192af0c660b105:1eabdf11f75e3a4fe3147baf7b5be24b$"
|
||||
}
|
||||
}
|
||||
|
BIN
mar/sprites.png
BIN
mar/sprites.png
Binary file not shown.
Before Width: | Height: | Size: 574 KiB After Width: | Height: | Size: 574 KiB |
Loading…
x
Reference in New Issue
Block a user