Changed TRUE projection to ISOMETRIC and added MILITARY as a third projection preset const.

This commit is contained in:
lewster32
2014-08-23 14:43:18 +01:00
parent 01819fe31b
commit 8a6f02acef
3 changed files with 18 additions and 8 deletions
+8 -3
View File
@@ -1694,6 +1694,7 @@ Phaser.Plugin.Isometric.Point3.equals = function (a, b) {
*
* @classdesc
* Creates a new Isometric Projector object, which has helpers for projecting x, y and z coordinates into axonometric x and y equivalents.
* The projection code is based partly on code from isomer by Jordan 'jdan' Scales - web: http://jdan.github.io/isomer/ github: https://github.com/jdan/isomer
*
* @constructor
* @param {Phaser.Game} game - The current game object.
@@ -1736,7 +1737,8 @@ Phaser.Plugin.Isometric.Projector = function (game, projectionAngle) {
// Projection angles
Phaser.Plugin.Isometric.CLASSIC = Math.atan(0.5);
Phaser.Plugin.Isometric.TRUE = Math.PI / 6;
Phaser.Plugin.Isometric.ISOMETRIC = Math.PI / 6;
Phaser.Plugin.Isometric.MILITARY = Math.PI / 4;
Phaser.Plugin.Isometric.Projector.prototype = {
@@ -1795,8 +1797,11 @@ Phaser.Plugin.Isometric.Projector.prototype = {
out = new Phaser.Point3();
}
out.y = ((2 * point.y - point.x) / 2) + (this.game.world.height * this.anchor.y) - offsetY;
out.x = (point.x + out.y) - (this.game.world.width * this.anchor.x);
// out.y = ((2 * point.y - point.x) / 2) + (this.game.world.height * this.anchor.y) - offsetY;
// out.x = (point.x + out.y) - (this.game.world.width * this.anchor.x);
out.x = (point.x * this._transform[1][0]) - (point.y * this._transform[0][0]) - (this.game.world.width * this.anchor.x);
out.y = (point.x * this._transform[1][1]) + (point.y * this._transform[0][1]) - (this.game.world.height * this.anchor.y) - offsetY;
return out;
},
File diff suppressed because one or more lines are too long
+8 -3
View File
@@ -3,6 +3,7 @@
*
* @classdesc
* Creates a new Isometric Projector object, which has helpers for projecting x, y and z coordinates into axonometric x and y equivalents.
* The projection code is based partly on code from isomer by Jordan 'jdan' Scales - web: http://jdan.github.io/isomer/ github: https://github.com/jdan/isomer
*
* @constructor
* @param {Phaser.Game} game - The current game object.
@@ -45,7 +46,8 @@ Phaser.Plugin.Isometric.Projector = function (game, projectionAngle) {
// Projection angles
Phaser.Plugin.Isometric.CLASSIC = Math.atan(0.5);
Phaser.Plugin.Isometric.TRUE = Math.PI / 6;
Phaser.Plugin.Isometric.ISOMETRIC = Math.PI / 6;
Phaser.Plugin.Isometric.MILITARY = Math.PI / 4;
Phaser.Plugin.Isometric.Projector.prototype = {
@@ -104,8 +106,11 @@ Phaser.Plugin.Isometric.Projector.prototype = {
out = new Phaser.Point3();
}
out.y = ((2 * point.y - point.x) / 2) + (this.game.world.height * this.anchor.y) - offsetY;
out.x = (point.x + out.y) - (this.game.world.width * this.anchor.x);
// out.y = ((2 * point.y - point.x) / 2) + (this.game.world.height * this.anchor.y) - offsetY;
// out.x = (point.x + out.y) - (this.game.world.width * this.anchor.x);
out.x = (point.x * this._transform[1][0]) - (point.y * this._transform[0][0]) - (this.game.world.width * this.anchor.x);
out.y = (point.x * this._transform[1][1]) + (point.y * this._transform[0][1]) - (this.game.world.height * this.anchor.y) - offsetY;
return out;
},