non working layers

This commit is contained in:
Jeena 2014-08-30 16:27:05 +02:00
parent 57135f3acc
commit 222fd09f3f
7 changed files with 58 additions and 30 deletions

View file

@ -1,13 +1,15 @@
define([
"Game/Core/GameObjects/Item",
"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) {
Parent.call(this, physicsEngine, uid, options);
this.layerId = Layer.ID.ITEM;
}
Item.prototype = Object.create(Parent.prototype);
@ -22,10 +24,11 @@ function (Parent, Settings, Nc) {
var callback = function(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,
this.layerId,
texturePath,
callback,
{
@ -40,13 +43,14 @@ function (Parent, Settings, Nc) {
};
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);
};
Item.prototype.render = function() {
Nc.trigger(Nc.ns.client.view.mesh.update,
this.layerId,
this.mesh,
{
x: this.body.GetPosition().x * Settings.RATIO,
@ -63,6 +67,7 @@ function (Parent, Settings, Nc) {
if(oldFlipDirection != direction) {
Nc.trigger(Nc.ns.client.view.mesh.update,
this.layerId,
this.mesh,
{
xScale: direction