mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
non working layers
This commit is contained in:
parent
57135f3acc
commit
222fd09f3f
7 changed files with 58 additions and 30 deletions
|
|
@ -3,12 +3,14 @@ define([
|
||||||
"Game/Config/Settings",
|
"Game/Config/Settings",
|
||||||
"Lib/Utilities/NotificationCenter",
|
"Lib/Utilities/NotificationCenter",
|
||||||
"Lib/Utilities/Exception",
|
"Lib/Utilities/Exception",
|
||||||
"Lib/Utilities/ColorConverter"
|
"Lib/Utilities/ColorConverter",
|
||||||
|
"Game/Client/View/Abstract/Layer",
|
||||||
],
|
],
|
||||||
|
|
||||||
function (Parent, Settings, Nc, Exception, ColorConverter) {
|
function (Parent, Settings, Nc, Exception, ColorConverter, Layer) {
|
||||||
|
|
||||||
function Doll(physicsEngine, uid, player) {
|
function Doll(physicsEngine, uid, player) {
|
||||||
|
this.layerId = Layer.ID.SPAWN;
|
||||||
this.animationDef = {
|
this.animationDef = {
|
||||||
"stand": [1,1],
|
"stand": [1,1],
|
||||||
"walk": [2,28],
|
"walk": [2,28],
|
||||||
|
|
@ -46,11 +48,13 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
||||||
if(this.animatedMeshes[this.actionState]) {
|
if(this.animatedMeshes[this.actionState]) {
|
||||||
Nc.trigger(
|
Nc.trigger(
|
||||||
Nc.ns.client.view.mesh.update,
|
Nc.ns.client.view.mesh.update,
|
||||||
|
this.layerId,
|
||||||
this.animatedMeshesContainer.withArms[this.actionState],
|
this.animatedMeshesContainer.withArms[this.actionState],
|
||||||
{ visible: false }
|
{ visible: false }
|
||||||
);
|
);
|
||||||
Nc.trigger(
|
Nc.trigger(
|
||||||
Nc.ns.client.view.mesh.update,
|
Nc.ns.client.view.mesh.update,
|
||||||
|
this.layerId,
|
||||||
this.animatedMeshesContainer.withoutArms[this.actionState],
|
this.animatedMeshesContainer.withoutArms[this.actionState],
|
||||||
{ visible: false }
|
{ visible: false }
|
||||||
);
|
);
|
||||||
|
|
@ -60,6 +64,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
||||||
|
|
||||||
Nc.trigger(
|
Nc.trigger(
|
||||||
Nc.ns.client.view.mesh.update,
|
Nc.ns.client.view.mesh.update,
|
||||||
|
this.layerId,
|
||||||
this.animatedMeshes[this.actionState],
|
this.animatedMeshes[this.actionState],
|
||||||
{
|
{
|
||||||
visible: true,
|
visible: true,
|
||||||
|
|
@ -73,7 +78,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
var setShirtColor = function (mesh) {
|
var setShirtColor = function (mesh) {
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.addFilter, mesh, 'colorRangeReplace', {
|
Nc.trigger(Nc.ns.client.view.mesh.addFilter, self.layerId, mesh, 'colorRangeReplace', {
|
||||||
minColor: 0x3b4a31,
|
minColor: 0x3b4a31,
|
||||||
maxColor: 0x657f54,
|
maxColor: 0x657f54,
|
||||||
newColor: self.primaryColor,
|
newColor: self.primaryColor,
|
||||||
|
|
@ -112,12 +117,12 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
||||||
|
|
||||||
var callback = function(mesh) {
|
var callback = function(mesh) {
|
||||||
self.animatedMeshesContainer[arm][key] = mesh;
|
self.animatedMeshesContainer[arm][key] = mesh;
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.add, mesh);
|
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh);
|
||||||
|
|
||||||
setShirtColor(mesh);
|
setShirtColor(mesh);
|
||||||
};
|
};
|
||||||
|
|
||||||
Nc.trigger(Nc.ns.client.view.animatedMesh.create, texturePaths, callback, {
|
Nc.trigger(Nc.ns.client.view.animatedMesh.create, this.layerId, texturePaths, callback, {
|
||||||
visible: false,
|
visible: false,
|
||||||
pivot: {
|
pivot: {
|
||||||
x: 35/2 * 4,
|
x: 35/2 * 4,
|
||||||
|
|
@ -135,9 +140,9 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
||||||
var texturePath = Settings.GRAPHICS_PATH + "Characters/Chuck/head.png";
|
var texturePath = Settings.GRAPHICS_PATH + "Characters/Chuck/head.png";
|
||||||
var callback = function (mesh) {
|
var callback = function (mesh) {
|
||||||
self.headMesh = mesh;
|
self.headMesh = mesh;
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.add, mesh);
|
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh);
|
||||||
}
|
}
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.create, texturePath, callback, {
|
Nc.trigger(Nc.ns.client.view.mesh.create, this.layerId, texturePath, callback, {
|
||||||
pivot: {
|
pivot: {
|
||||||
x: 5,
|
x: 5,
|
||||||
y: 12
|
y: 12
|
||||||
|
|
@ -151,11 +156,10 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
||||||
texturePath = Settings.GRAPHICS_PATH + "Characters/Chuck/holdingArm.png";
|
texturePath = Settings.GRAPHICS_PATH + "Characters/Chuck/holdingArm.png";
|
||||||
var callback = function (mesh) {
|
var callback = function (mesh) {
|
||||||
self.holdingArmMesh = mesh;
|
self.holdingArmMesh = mesh;
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.add, mesh);
|
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh);
|
||||||
|
|
||||||
setShirtColor(mesh);
|
setShirtColor(mesh);
|
||||||
}
|
}
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.create, texturePath, callback, {
|
Nc.trigger(Nc.ns.client.view.mesh.create, this.layerId, texturePath, callback, {
|
||||||
visible: false,
|
visible: false,
|
||||||
pivot: {
|
pivot: {
|
||||||
x: 35/2 * 4,
|
x: 35/2 * 4,
|
||||||
|
|
@ -175,6 +179,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
||||||
if(oldLookDirection != this.lookDirection) {
|
if(oldLookDirection != this.lookDirection) {
|
||||||
for(var key in this.animatedMeshes) {
|
for(var key in this.animatedMeshes) {
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
|
this.layerId,
|
||||||
this.animatedMeshes[key],
|
this.animatedMeshes[key],
|
||||||
{
|
{
|
||||||
xScale: this.lookDirection
|
xScale: this.lookDirection
|
||||||
|
|
@ -183,6 +188,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
|
this.layerId,
|
||||||
this.holdingArmMesh,
|
this.holdingArmMesh,
|
||||||
{
|
{
|
||||||
xScale: this.lookDirection
|
xScale: this.lookDirection
|
||||||
|
|
@ -193,6 +199,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
||||||
var angle = Math.atan2(this.lookAtXY.x, this.lookAtXY.y) / 2 - 0.7855 * this.lookDirection; // 0.7855 = 45°
|
var angle = Math.atan2(this.lookAtXY.x, this.lookAtXY.y) / 2 - 0.7855 * this.lookDirection; // 0.7855 = 45°
|
||||||
|
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
|
this.layerId,
|
||||||
this.headMesh,
|
this.headMesh,
|
||||||
{
|
{
|
||||||
xScale: this.lookDirection,
|
xScale: this.lookDirection,
|
||||||
|
|
@ -205,22 +212,22 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
||||||
Parent.prototype.grab.call(this, item);
|
Parent.prototype.grab.call(this, item);
|
||||||
this.animatedMeshes = this.animatedMeshesContainer.withoutArms;
|
this.animatedMeshes = this.animatedMeshesContainer.withoutArms;
|
||||||
this.setActionState(this.actionState, true);
|
this.setActionState(this.actionState, true);
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.update, this.holdingArmMesh, { visible: true });
|
Nc.trigger(Nc.ns.client.view.mesh.update, this.layerId, this.holdingArmMesh, { visible: true });
|
||||||
};
|
};
|
||||||
|
|
||||||
Doll.prototype.throw = function(item, x, y) {
|
Doll.prototype.throw = function(item, x, y) {
|
||||||
Parent.prototype.throw.call(this, item, x, y);
|
Parent.prototype.throw.call(this, item, x, y);
|
||||||
this.animatedMeshes = this.animatedMeshesContainer.withArms;
|
this.animatedMeshes = this.animatedMeshesContainer.withArms;
|
||||||
this.setActionState(this.actionState, true);
|
this.setActionState(this.actionState, true);
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.update, this.holdingArmMesh, { visible: false });
|
Nc.trigger(Nc.ns.client.view.mesh.update, this.layerId, this.holdingArmMesh, { visible: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
Doll.prototype.destroy = function () {
|
Doll.prototype.destroy = function () {
|
||||||
for (var key in this.animatedMeshes) {
|
for (var key in this.animatedMeshes) {
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.remove, this.animatedMeshes[key]);
|
Nc.trigger(Nc.ns.client.view.mesh.remove, this.layerId, this.animatedMeshes[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.remove, this.headMesh);
|
Nc.trigger(Nc.ns.client.view.mesh.remove, this.layerId, this.headMesh);
|
||||||
|
|
||||||
Parent.prototype.destroy.call(this);
|
Parent.prototype.destroy.call(this);
|
||||||
}
|
}
|
||||||
|
|
@ -228,6 +235,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
||||||
Doll.prototype.render = function() {
|
Doll.prototype.render = function() {
|
||||||
if(this.actionState) {
|
if(this.actionState) {
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
|
this.layerId,
|
||||||
this.animatedMeshes[this.actionState],
|
this.animatedMeshes[this.actionState],
|
||||||
{
|
{
|
||||||
x: this.body.GetPosition().x * Settings.RATIO,
|
x: this.body.GetPosition().x * Settings.RATIO,
|
||||||
|
|
@ -237,6 +245,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
||||||
);
|
);
|
||||||
|
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
|
this.layerId,
|
||||||
this.headMesh,
|
this.headMesh,
|
||||||
{
|
{
|
||||||
x: this.body.GetPosition().x * Settings.RATIO,
|
x: this.body.GetPosition().x * Settings.RATIO,
|
||||||
|
|
@ -245,6 +254,7 @@ function (Parent, Settings, Nc, Exception, ColorConverter) {
|
||||||
)
|
)
|
||||||
|
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
|
this.layerId,
|
||||||
this.holdingArmMesh,
|
this.holdingArmMesh,
|
||||||
{
|
{
|
||||||
x: this.body.GetPosition().x * Settings.RATIO,
|
x: this.body.GetPosition().x * Settings.RATIO,
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
define([
|
define([
|
||||||
"Game/Core/GameObjects/Item",
|
"Game/Core/GameObjects/Item",
|
||||||
"Game/Config/Settings",
|
"Game/Config/Settings",
|
||||||
"Lib/Utilities/NotificationCenter"
|
"Lib/Utilities/NotificationCenter",
|
||||||
|
"Game/Client/View/Abstract/Layer"
|
||||||
],
|
],
|
||||||
|
|
||||||
function (Parent, Settings, Nc) {
|
function (Parent, Settings, Nc, Layer) {
|
||||||
|
|
||||||
function Item(physicsEngine, uid, options) {
|
function Item(physicsEngine, uid, options) {
|
||||||
Parent.call(this, physicsEngine, uid, options);
|
Parent.call(this, physicsEngine, uid, options);
|
||||||
|
this.layerId = Layer.ID.ITEM;
|
||||||
}
|
}
|
||||||
|
|
||||||
Item.prototype = Object.create(Parent.prototype);
|
Item.prototype = Object.create(Parent.prototype);
|
||||||
|
|
@ -22,10 +24,11 @@ function (Parent, Settings, Nc) {
|
||||||
|
|
||||||
var callback = function(mesh) {
|
var callback = function(mesh) {
|
||||||
self.mesh = mesh;
|
self.mesh = mesh;
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.add, mesh);
|
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.create,
|
Nc.trigger(Nc.ns.client.view.mesh.create,
|
||||||
|
this.layerId,
|
||||||
texturePath,
|
texturePath,
|
||||||
callback,
|
callback,
|
||||||
{
|
{
|
||||||
|
|
@ -40,13 +43,14 @@ function (Parent, Settings, Nc) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Item.prototype.destroy = function() {
|
Item.prototype.destroy = function() {
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.remove, this.mesh);
|
Nc.trigger(Nc.ns.client.view.mesh.remove, this.layerId, this.mesh);
|
||||||
Parent.prototype.destroy.call(this);
|
Parent.prototype.destroy.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
Item.prototype.render = function() {
|
Item.prototype.render = function() {
|
||||||
|
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
|
this.layerId,
|
||||||
this.mesh,
|
this.mesh,
|
||||||
{
|
{
|
||||||
x: this.body.GetPosition().x * Settings.RATIO,
|
x: this.body.GetPosition().x * Settings.RATIO,
|
||||||
|
|
@ -63,6 +67,7 @@ function (Parent, Settings, Nc) {
|
||||||
|
|
||||||
if(oldFlipDirection != direction) {
|
if(oldFlipDirection != direction) {
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
|
this.layerId,
|
||||||
this.mesh,
|
this.mesh,
|
||||||
{
|
{
|
||||||
xScale: direction
|
xScale: direction
|
||||||
|
|
|
||||||
|
|
@ -2,12 +2,14 @@ define([
|
||||||
"Game/Core/GameObjects/Items/RagDoll",
|
"Game/Core/GameObjects/Items/RagDoll",
|
||||||
"Game/Core/GameObjects/Item",
|
"Game/Core/GameObjects/Item",
|
||||||
"Game/Config/Settings",
|
"Game/Config/Settings",
|
||||||
"Lib/Utilities/NotificationCenter"
|
"Lib/Utilities/NotificationCenter",
|
||||||
|
"Game/Client/View/Abstract/Layer"
|
||||||
],
|
],
|
||||||
|
|
||||||
function (Parent, CoreItem, Settings, Nc) {
|
function (Parent, CoreItem, Settings, Nc, Layer) {
|
||||||
|
|
||||||
function RagDoll(physicsEngine, uid, options) {
|
function RagDoll(physicsEngine, uid, options) {
|
||||||
|
this.layerId = Layer.ID.SPAWN;
|
||||||
this.limbMeshes = {};
|
this.limbMeshes = {};
|
||||||
this.baseMeshName = "chest";
|
this.baseMeshName = "chest";
|
||||||
this.characterName = "Chuck";
|
this.characterName = "Chuck";
|
||||||
|
|
@ -36,10 +38,11 @@ function (Parent, CoreItem, Settings, Nc) {
|
||||||
self.limbMeshes[name] = mesh;
|
self.limbMeshes[name] = mesh;
|
||||||
}
|
}
|
||||||
|
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.add, mesh);
|
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.create,
|
Nc.trigger(Nc.ns.client.view.mesh.create,
|
||||||
|
this.layerId,
|
||||||
texturePath + name + ".png",
|
texturePath + name + ".png",
|
||||||
callback,
|
callback,
|
||||||
{
|
{
|
||||||
|
|
@ -60,6 +63,7 @@ function (Parent, CoreItem, Settings, Nc) {
|
||||||
for(var name in this.limbMeshes) {
|
for(var name in this.limbMeshes) {
|
||||||
if(this.limbs[name]) {
|
if(this.limbs[name]) {
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
|
this.layerId,
|
||||||
this.limbMeshes[name],
|
this.limbMeshes[name],
|
||||||
{
|
{
|
||||||
x: this.limbs[name].GetPosition().x * Settings.RATIO,
|
x: this.limbs[name].GetPosition().x * Settings.RATIO,
|
||||||
|
|
@ -80,6 +84,7 @@ function (Parent, CoreItem, Settings, Nc) {
|
||||||
|
|
||||||
if(oldFlipDirection != direction) {
|
if(oldFlipDirection != direction) {
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
|
this.layerId,
|
||||||
this.mesh,
|
this.mesh,
|
||||||
{
|
{
|
||||||
xScale: direction
|
xScale: direction
|
||||||
|
|
@ -88,6 +93,7 @@ function (Parent, CoreItem, Settings, Nc) {
|
||||||
|
|
||||||
for (var name in this.limbMeshes) {
|
for (var name in this.limbMeshes) {
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
|
this.layerId,
|
||||||
this.limbMeshes[name],
|
this.limbMeshes[name],
|
||||||
{
|
{
|
||||||
xScale: direction
|
xScale: direction
|
||||||
|
|
@ -100,7 +106,7 @@ function (Parent, CoreItem, Settings, Nc) {
|
||||||
RagDoll.prototype.destroy = function() {
|
RagDoll.prototype.destroy = function() {
|
||||||
|
|
||||||
for (var name in this.limbMeshes) {
|
for (var name in this.limbMeshes) {
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.remove, this.limbMeshes[name]);
|
Nc.trigger(Nc.ns.client.view.mesh.remove, this.layerId, this.limbMeshes[name]);
|
||||||
};
|
};
|
||||||
|
|
||||||
Parent.prototype.destroy.call(this);
|
Parent.prototype.destroy.call(this);
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,15 @@
|
||||||
define([
|
define([
|
||||||
"Game/Core/GameObjects/Tile",
|
"Game/Core/GameObjects/Tile",
|
||||||
"Game/Config/Settings",
|
"Game/Config/Settings",
|
||||||
"Lib/Utilities/NotificationCenter"
|
"Lib/Utilities/NotificationCenter",
|
||||||
|
"Game/Client/View/Abstract/Layer"
|
||||||
],
|
],
|
||||||
|
|
||||||
function (Parent, Settings, Nc) {
|
function (Parent, Settings, Nc, Layer) {
|
||||||
|
|
||||||
function Tile(physicsEngine, uid, options) {
|
function Tile(physicsEngine, uid, options) {
|
||||||
Parent.call(this, physicsEngine, uid, options);
|
Parent.call(this, physicsEngine, uid, options);
|
||||||
|
this.layerId = Layer.ID.TILE;
|
||||||
}
|
}
|
||||||
|
|
||||||
Tile.prototype = Object.create(Parent.prototype);
|
Tile.prototype = Object.create(Parent.prototype);
|
||||||
|
|
@ -27,10 +29,11 @@ function (Parent, Settings, Nc) {
|
||||||
|
|
||||||
var callback = function(mesh) {
|
var callback = function(mesh) {
|
||||||
self.mesh = mesh;
|
self.mesh = mesh;
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.add, mesh);
|
Nc.trigger(Nc.ns.client.view.mesh.add, self.layerId, mesh);
|
||||||
}
|
}
|
||||||
|
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.create,
|
Nc.trigger(Nc.ns.client.view.mesh.create,
|
||||||
|
this.layerId,
|
||||||
texturePath,
|
texturePath,
|
||||||
callback,
|
callback,
|
||||||
{
|
{
|
||||||
|
|
@ -45,13 +48,14 @@ function (Parent, Settings, Nc) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Tile.prototype.destroy = function() {
|
Tile.prototype.destroy = function() {
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.remove, this.mesh);
|
Nc.trigger(Nc.ns.client.view.mesh.remove, this.layerId, this.mesh);
|
||||||
Parent.prototype.destroy.call(this);
|
Parent.prototype.destroy.call(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
Tile.prototype.render = function() {
|
Tile.prototype.render = function() {
|
||||||
|
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.update,
|
Nc.trigger(Nc.ns.client.view.mesh.update,
|
||||||
|
this.layerId,
|
||||||
this.mesh,
|
this.mesh,
|
||||||
{
|
{
|
||||||
x: this.body.GetPosition().x * Settings.RATIO,
|
x: this.body.GetPosition().x * Settings.RATIO,
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ function (Parent, Settings) {
|
||||||
|
|
||||||
function TiledLevel(uid, engine, gameObjects) {
|
function TiledLevel(uid, engine, gameObjects) {
|
||||||
Parent.call(this, uid, engine, gameObjects);
|
Parent.call(this, uid, engine, gameObjects);
|
||||||
|
this.layerId = "background";
|
||||||
}
|
}
|
||||||
|
|
||||||
TiledLevel.prototype = Object.create(Parent.prototype);
|
TiledLevel.prototype = Object.create(Parent.prototype);
|
||||||
|
|
@ -63,6 +64,7 @@ function (Parent, Settings) {
|
||||||
TiledLevel.prototype.addBackground = function(options) {
|
TiledLevel.prototype.addBackground = function(options) {
|
||||||
var texturePath = Settings.GRAPHICS_PATH + options.image;
|
var texturePath = Settings.GRAPHICS_PATH + options.image;
|
||||||
|
|
||||||
|
/*
|
||||||
var callback = function (mesh) {
|
var callback = function (mesh) {
|
||||||
Nc.trigger(Nc.ns.client.view.mesh.add, mesh, 0); // FIXME: add at z layer -1 or so
|
Nc.trigger(Nc.ns.client.view.mesh.add, mesh, 0); // FIXME: add at z layer -1 or so
|
||||||
}
|
}
|
||||||
|
|
@ -72,6 +74,7 @@ function (Parent, Settings) {
|
||||||
x: -(4000 - Settings.STAGE_WIDTH) / 2,
|
x: -(4000 - Settings.STAGE_WIDTH) / 2,
|
||||||
y: -(2959 + Settings.STAGE_HEIGHT + 700) / 2
|
y: -(2959 + Settings.STAGE_HEIGHT + 700) / 2
|
||||||
});
|
});
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
TiledLevel.prototype.getLayer = function(levelData, name) {
|
TiledLevel.prototype.getLayer = function(levelData, name) {
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,6 @@ function (Nc, Exception, Layer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var layer = new Layer(id, parallaxSpeed);
|
var layer = new Layer(id, parallaxSpeed);
|
||||||
|
|
||||||
var layerIndex = behind ? referenceIndex -1 : referenceIndex;
|
var layerIndex = behind ? referenceIndex -1 : referenceIndex;
|
||||||
|
|
||||||
this.layers.splice(layerIndex, 0, layer);
|
this.layers.splice(layerIndex, 0, layer);
|
||||||
|
|
@ -58,7 +57,7 @@ function (Nc, Exception, Layer) {
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
console.warn('No such layer: ' + id);
|
throw new Exception('No such layer: ' + id);
|
||||||
};
|
};
|
||||||
|
|
||||||
LayerManager.prototype.delegate = function(methodName, layerId) {
|
LayerManager.prototype.delegate = function(methodName, layerId) {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,8 @@ function() {
|
||||||
|
|
||||||
this.message = message.join(" ");
|
this.message = message.join(" ");
|
||||||
|
|
||||||
Error.call(this, this.message);
|
var e = Error.call(this, this.message);
|
||||||
|
console.log(e.stack)
|
||||||
}
|
}
|
||||||
|
|
||||||
Exception.prototype = Object.create(Error.prototype);
|
Exception.prototype = Object.create(Error.prototype);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue