mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
fixes initial level positioning
This commit is contained in:
parent
aaa1db4468
commit
cad112419d
14 changed files with 91 additions and 61 deletions
|
|
@ -6,18 +6,23 @@ function (Abstract) {
|
|||
|
||||
"use strict";
|
||||
|
||||
function Layer(name, parallaxSpeed) {
|
||||
function Layer(name, options) {
|
||||
this.name = name;
|
||||
this.parallaxSpeed = parallaxSpeed;
|
||||
this.parallaxSpeed = options.parallaxSpeed || 0;
|
||||
this.zoom = {
|
||||
current: 1,
|
||||
target: 1
|
||||
current: window.innerWidth / 600,
|
||||
target: window.innerWidth / 600
|
||||
};
|
||||
this.position = {
|
||||
current: { x: 0, y: 0},
|
||||
target: { x: 0, y: 0}
|
||||
};
|
||||
|
||||
if(options.levelSize) {
|
||||
this.position.current.x = -options.levelSize.width / 2;
|
||||
this.position.current.y = -options.levelSize.height / 2;
|
||||
}
|
||||
|
||||
this.ncTokens = [];
|
||||
}
|
||||
|
||||
|
|
@ -52,7 +57,9 @@ function (Abstract) {
|
|||
};
|
||||
|
||||
Layer.prototype.destroy = function() {
|
||||
|
||||
for (var i = 0; i < this.ncTokens.length; i++) {
|
||||
Nc.off(this.ncTokens[i]);
|
||||
};
|
||||
};
|
||||
|
||||
return Layer;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue