beginMove(result: Function) {
if (this.ownFwy_cp.x > 0 && this.moveTaget.x > 0) {
if (this.ownFwy_cp.x > this.moveTaget.x) {
width = this.ownFwy_cp.x - this.moveTaget.x;
width = this.moveTaget.x - this.ownFwy_cp.x;
} else if ((this.ownFwy_cp.x > 0 && this.moveTaget.x < 0) || (this.ownFwy_cp.x < 0 && this.moveTaget.x > 0)) {
width = Math.abs(this.ownFwy_cp.x) + Math.abs(this.moveTaget.x);
if (Math.abs(this.ownFwy_cp.x) > Math.abs(this.moveTaget.x)) {
width = Math.abs(this.ownFwy_cp.x) - Math.abs(this.moveTaget.x);
width = Math.abs(this.moveTaget.x) + Math.abs(this.ownFwy_cp.x);
if (this.ownFwy_cp.y > 0 && this.moveTaget.y > 0) {
if (this.ownFwy_cp.y > this.moveTaget.y) {
height = this.ownFwy_cp.y - this.moveTaget.y;
height = this.moveTaget.y - this.ownFwy_cp.y;
} else if ((this.ownFwy_cp.y > 0 && this.moveTaget.y < 0) || (this.ownFwy_cp.y < 0 && this.moveTaget.y > 0)) {
height = Math.abs(this.ownFwy_cp.y) + Math.abs(this.moveTaget.y);
if (Math.abs(this.ownFwy_cp.y) > Math.abs(this.moveTaget.y)) {
height = Math.abs(this.ownFwy_cp.y) - Math.abs(this.moveTaget.y);
height = Math.abs(this.moveTaget.y) + Math.abs(this.ownFwy_cp.y);
console.log("w:" + width + "...h:" + height + "...r:" + ratio);
Laya.timer.frameLoop(1, this, () => {
if (this.ownFwy_cp.x > this.moveTaget.x) {
this.ownFwy_cp.x -= this.moveSpeed;
if (this.ownFwy_cp.x <= this.moveTaget.x) {
this.ownFwy_cp.x = this.moveTaget.x;
} else if (this.ownFwy_cp.x < this.moveTaget.x) {
this.ownFwy_cp.x += this.moveSpeed;
if (this.ownFwy_cp.x > this.moveTaget.x) {
this.ownFwy_cp.x = this.moveTaget.x;
if (this.ownFwy_cp.y > this.moveTaget.y) {
this.ownFwy_cp.y -= this.moveSpeed/ratio;
if (this.ownFwy_cp.y < this.moveTaget.y) {
this.ownFwy_cp.y = this.moveTaget.y;
} else if (this.ownFwy_cp.y < this.moveTaget.y) {
this.ownFwy_cp.y += this.moveSpeed/ratio;
if (this.ownFwy_cp.y > this.moveTaget.y) {
this.ownFwy_cp.y = this.moveTaget.y;
if (this.ownFwy_cp.x > this.moveTaget.x) {
this.ownFwy_cp.x -= this.moveSpeed/ratio;
if (this.ownFwy_cp.x <= this.moveTaget.x) {
this.ownFwy_cp.x = this.moveTaget.x;
} else if (this.ownFwy_cp.x < this.moveTaget.x) {
this.ownFwy_cp.x += this.moveSpeed/ratio;
if (this.ownFwy_cp.x > this.moveTaget.x) {
this.ownFwy_cp.x = this.moveTaget.x;
if (this.ownFwy_cp.y > this.moveTaget.y) {
this.ownFwy_cp.y -= this.moveSpeed;
if (this.ownFwy_cp.y < this.moveTaget.y) {
this.ownFwy_cp.y = this.moveTaget.y;
} else if (this.ownFwy_cp.y < this.moveTaget.y) {
this.ownFwy_cp.y += this.moveSpeed;
if (this.ownFwy_cp.y > this.moveTaget.y) {
this.ownFwy_cp.y = this.moveTaget.y;
if (this.ownFwy_cp.x == this.moveTaget.x && this.ownFwy_cp.y == this.moveTaget.y) {
Laya.timer.clearAll(this);