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

来源:互联网 发布:苹果点位图软件 编辑:程序博客网 时间:2024/05/17 22:40

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);}

0 0