mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
fixes initial level positioning
This commit is contained in:
parent
aaa1db4468
commit
cad112419d
14 changed files with 91 additions and 61 deletions
|
|
@ -12,6 +12,10 @@ function (Parent, Settings, Nc, PIXI, AbstractLayer) {
|
|||
|
||||
function Level (uid, engine, gameObjects) {
|
||||
Parent.call(this, uid, engine, gameObjects);
|
||||
this.levelSize = {
|
||||
width: 0,
|
||||
height: 0
|
||||
}
|
||||
}
|
||||
|
||||
Level.prototype = Object.create(Parent.prototype);
|
||||
|
|
@ -112,7 +116,16 @@ function (Parent, Settings, Nc, PIXI, AbstractLayer) {
|
|||
if (options.properties && options.properties.parallaxSpeed) {
|
||||
parallaxSpeed = parseFloat(options.properties.parallaxSpeed);
|
||||
}
|
||||
Nc.trigger(Nc.ns.client.view.layer.createAndInsert, options.layerId, parallaxSpeed, behind, referenceId);
|
||||
Nc.trigger(
|
||||
Nc.ns.client.view.layer.createAndInsert,
|
||||
options.layerId,
|
||||
{
|
||||
parallaxSpeed: parallaxSpeed,
|
||||
levelSize: this.levelSize
|
||||
},
|
||||
behind,
|
||||
referenceId
|
||||
);
|
||||
};
|
||||
|
||||
return Level;
|
||||
|
|
|
|||
|
|
@ -16,16 +16,14 @@ function (Parent, Settings, Nc) {
|
|||
TiledLevel.prototype = Object.create(Parent.prototype);
|
||||
|
||||
TiledLevel.prototype.setup = function(levelData) {
|
||||
/*
|
||||
FIXME: find a name for this shit!
|
||||
for (var i = 0; i < levelData.layers.length; i++) {
|
||||
var layerOptions = levelData.layers[i];
|
||||
layerOptions.z = i;
|
||||
if(!this.layerMapping[layerOptions.name]) {
|
||||
this.createLayer(layerOptions);
|
||||
}
|
||||
var tilesLayerData = this.getLayer(levelData, "tiles");
|
||||
this.levelSize = {
|
||||
width: tilesLayerData.width * Settings.TILE_SIZE,
|
||||
height: tilesLayerData.height * Settings.TILE_SIZE
|
||||
};
|
||||
*/
|
||||
|
||||
Nc.trigger(Nc.ns.client.view.layer.levelSizeUpdate, this.levelSize);
|
||||
|
||||
Parent.prototype.setup.call(this, levelData);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue