init
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
cc.Class({
|
||||
extends: cc.Component,
|
||||
properties: {
|
||||
Time: {
|
||||
default: 0,
|
||||
displayName: "移动时间"
|
||||
},
|
||||
startNode: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
displayName: "开始位置节点"
|
||||
},
|
||||
endNode: {
|
||||
default: null,
|
||||
type: cc.Node,
|
||||
displayName: "结束位置节点"
|
||||
}
|
||||
},
|
||||
start: function () {
|
||||
cc.global.level > 3 && (this.node.active = false);
|
||||
this.startpos = this.node.getPosition();
|
||||
if (this.endNode) {
|
||||
this.endpos = cc.global.onTransitionPosition(this.endNode.parent, this.node.parent, this.endNode.getPosition());
|
||||
this.showzhiyin();
|
||||
} else {
|
||||
this.node.getComponent(dragonBones.ArmatureDisplay).playAnimation("qd_shou");
|
||||
}
|
||||
if (this.startNode) {
|
||||
this.startpos = cc.global.onTransitionPosition(this.startNode.parent, this.node.parent, this.startNode.getPosition());
|
||||
this.node.position = cc.v2(this.startpos.x, this.startpos.y);
|
||||
}
|
||||
},
|
||||
showzhiyin: function () {
|
||||
var e = cc.moveTo(this.Time, cc.v2(this.endpos.x, this.endpos.y));
|
||||
var o = cc.fadeTo(.2, 0);
|
||||
var t = cc.callFunc(function () {
|
||||
cc.log("call function");
|
||||
this.node.position = cc.v2(this.startpos.x, this.startpos.y);
|
||||
this.node.opacity = 255;
|
||||
}.bind(this));
|
||||
var i = cc.sequence([e, o, t]);
|
||||
var n = cc.repeatForever(i);
|
||||
this.node.runAction(n);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user