您的位置:首页 > 其它

设定schedule 每隔1秒向鼠标拖拽的当前位置发射一个Sprite

2016-06-22 09:12 387 查看
mySprite:null,

var that = this;
that.schedule(0.001,cc.REPEAT_FOREVER);//定时器
var listener = cc.EventListener.create({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
swallowTouches: true,   // 吞没事件
onTouchBegan: function (touch, event) {
return true;
},
onTouchMoved:function(touch,event){
that.mySprite = new cc.Sprite("res/mySprite.png");
that.mySprite.setPosition(touch.getLocation().x,touch.getLocation().y);
that.addChild(that.mySprite);
},

})
cc.eventManager.addListener(listener,this);
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: