@758482981 写道:
绳子一开始是摇晃的,点击后生长,然后缩小,然后回归摇晃,我这么写会点击会一直长,如何在放大缩小的时候不能点击呀
onLoad: function () {
this.shakeAction = cc.repeatForever(cc.sequence(cc.rotateTo(3,60),cc.rotateTo(3,-60)));
this.node.runAction(this.shakeAction)
this.move = false
if(!this.move){
this.touch()}
},
touch:function(){
var self = this;
var listener1 = cc.EventListener.create({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
onTouchBegan: function (touch, event) {this.scale() return true; }.bind(self), onTouchEnded: function (touch, event) { }.bind(self) }); cc.eventManager.addListener(listener1, this.node); }, scale:function(){ this.move = true this.node.stopAllActions(); var f1 = cc.scaleBy(2, 1, 2); var f2 = f1.reverse(); var f3 = cc.sequence(f1,f2,cc.callFunc(function() { this.node.runAction(this.shakeAction); this.move = false }, this)); this.node.runAction(f3) },
帖子: 2
参与者: 1