mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
fixed skateboard and mesh positioning
This commit is contained in:
parent
7220e3b388
commit
bdab2a5760
9 changed files with 83 additions and 45 deletions
|
|
@ -89,12 +89,18 @@ function (Parent, DomController, PIXI, Settings, NotificationCenter) {
|
|||
if (options.height) mesh.height = options.height;
|
||||
if (options.visible === true || options.visible === false) mesh.visible = options.visible;
|
||||
if (options.pivot) {
|
||||
switch(options.pivot.length) {
|
||||
default:
|
||||
mesh.pivot.x = mesh.width / 2;
|
||||
mesh.pivot.y = mesh.height;
|
||||
break;
|
||||
if(options.pivot.length) {
|
||||
switch(options.pivot) {
|
||||
case "lb":
|
||||
mesh.pivot.x = mesh.width / 2;
|
||||
mesh.pivot.y = mesh.height / 2;
|
||||
break;
|
||||
default:
|
||||
mesh.pivot.x = mesh.width / 2;
|
||||
mesh.pivot.y = mesh.height;
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -105,16 +111,11 @@ function (Parent, DomController, PIXI, Settings, NotificationCenter) {
|
|||
}
|
||||
|
||||
PixiView.prototype.calculateCameraPosition = function() {
|
||||
|
||||
var reference = this.me.getPosition();
|
||||
var pos = {};
|
||||
|
||||
pos.x = -reference.x;
|
||||
pos.y = reference.y;
|
||||
|
||||
var zoom = this.container.scale.x;
|
||||
pos.x = pos.x * Settings.RATIO * zoom;
|
||||
pos.y = -(pos.y * Settings.RATIO) * zoom;
|
||||
|
||||
var pos = this.me.getHeadPosition();
|
||||
pos.x *= -Settings.RATIO * zoom;
|
||||
pos.y *= -Settings.RATIO * zoom;
|
||||
|
||||
pos.x -= this.me.playerController.xyInput.x * Settings.STAGE_WIDTH / 4;
|
||||
pos.y += this.me.playerController.xyInput.y * Settings.STAGE_HEIGHT / 4;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue