Phaser.PathPoint = function (x, y, vx, vy, speed, data, branchPath, branchPointIndex){ if (speed === undefined) { speed = 1; } if (data === undefined) { data = { type: 0, value: 0} ; } if (branchPath === undefined) { branchPath = null ; } if (branchPointIndex === undefined) { branchPointIndex = 0; } this.x = x; this.y = y; this.vx = vx; this.vy = vy; this.speed = speed; this.data = data; this.branchPath = branchPath; this.branchPointIndex = branchPointIndex; this.branchType = 0; this.curve = null ; this.active = false ; this.controlPoints = null ; } ; Phaser.PathPoint.prototype.constructor = Phaser.PathPoint; Phaser.PathPoint.DATA_NONE = 0; Phaser.PathPoint.DATA_PAUSE = 1; Phaser.PathPoint.DATA_VALUE = 2; Phaser.PathPoint.DATA_COUNTER = 3; Phaser.PathPoint.prototype = { setTo: function (x, y, vx, vy){ this.x = x; this.y = y; if (vx !== undefined) { this.vx = vx; } if (vy !== undefined) { this.vy = vy; } this.curve = null ; return this; } , setTangent: function (vx, vy){ this.vx = vx; this.vy = vy; this.curve = null ; return this; } , clone: function (out){ if (out === undefined) { out = new Phaser.PathPoint(); } return out.copy(this); } , copy: function (source){ this.x = source.x; this.y = source.y; this.vx = source.vx; this.vy = source.vy; this.speed = source.speed; this.data = source.data; this.branchPath = source.branchPath; this.branchPointIndex = source.branchPointIndex; this.curve = null ; this.active = source.active; return this; } , equals: function (pathPoint, offsetX, offsetY){ if (offsetX === undefined) { offsetX = 0; } if (offsetY === undefined) { offsetY = 0; } return (this.x === pathPoint.x + offsetX && this.y === pathPoint.y + offsetY && this.speed === pathPoint.speed); } , toJSON: function (){ return { x: this.x, y: this.y, vx: this.vx, vy: this.vy, speed: this.speed, data: this.data, branchPath: !!this.branchPath? this.branchPath.name: null , branchPointIndex: this.branchPointIndex, branchType: this.branchType} ; } } ;