悬赏30¥ cocos2d-html5 3.15.1 制作刮奖功能,渲染异常!

查看了很多的文章(C++,JS),试了很多方法,但是都没有成功,希望万能的网友能够指出问题所在,谢谢 :slight_smile:

var HelloWorldLayer = cc.Layer.extend({
sprite: null ,
pEraser: null ,
pRTex: null ,

ctor: function () {
    // ////////////////////////////
    // 1. super init first
    this ._super();

    var size = cc.winSize;



    // hello world背景图片
    this .sprite = new cc.Sprite("res/shopping_mall_background.png");
    this .sprite.attr({
        x: size.width / 2 ,
        y: size.height / 2
    });
    this .addChild( this .sprite, 0 );

    // 橡皮擦
    this .pEraser = new cc.DrawNode();
    this .pEraser.drawDot(cc.p(0, 0), 20, cc.color(255, 255, 255, 0));
    this .pEraser. retain();

    // 通过pRTex实现橡皮擦
    this.pRTex = new cc.RenderTexture(size.width,size.height,cc.Texture2D.PIXEL_FORMAT_RGBA8888);
    this.pRTex.setPosition(cc.p(size.width/2, size.height/2 ));
    this.addChild(this.pRTex,10);

    // 加载等待被擦除的图片
    var pBg = new cc.Sprite("res/shopping_mall_title.png");
    pBg.setPosition(cc.p(size.width /2, size.height/2 ));
    this.pRTex.begin();
    pBg.visit(this.pRTex);
    this.pRTex.end();



    cc.eventManager.addListener({
        event: cc.EventListener.TOUCH_ONE_BY_ONE,
        onTouchBegan: function (touches, event){
            cc.log( "start" );
            return  true ;
        },
        onTouchMoved: function (touch, event) {
            var target = event.getCurrentTarget();
            target.pEraser.setPosition(touch.getLocation());
            target.eraseByBlend();
        }
    }, this );

},

eraseByBlend : function ()
{
    this .pEraser.setBlendFunc(cc.ONE_MINUS_SRC_ALPHA, cc.ZERO);
    this .pRTex.begin();
    this .pEraser.visit();
    this .pRTex.end();
}

});

var TestScene = cc.Scene.extend({
onEnter: function () {
this._super();
var layer = new HelloWorldLayer();
this.addChild(layer);
}
});

http://forum.cocos.com/t/ccc/51528/1
这是我的实现思路,使用的是CCC,其实主要思路是使用ClipingNode。楼主解决了,记得给我打钱啊

能不能给下代码,刚接触cocos不是很熟悉,项目又需要马上做出来,谢谢 : )

http://forum.cocos.com/t/ccc/51528/23
这边不是有吗,照着改下