cocos2d-js中的扑克牌翻转的效果

在2d游戏场景中,想制作一个扑克牌翻转的立体效果。

首先准备一张正面和反面的牌,生成反面的牌:

this.pokerSpr = new cc.Sprite(res.poker1_png);
this.pokerSpr.x = 200;
this.pokerSpr.y = 300;
this.addChild(this.pokerSpr);

点击界面改变图片:

this.pokerSpr.runAction(cc.sequence(
    cc.rotateBy(0.5,0,90),
    cc.callFunc(function(target){
        this.pokerSpr.setTexture(res.poker1_png);
    },this),
    cc.rotateBy(0.5,0,90)
));

猜你喜欢

转载自blog.csdn.net/kang_lee/article/details/78059465