标签:def img seq callbacks action xtend start this node
cc.Class({ extends: cc.Component, properties: { carModel: { default: null, type: cc.Sprite }, bgModel: { default: null, type: cc.Sprite } }, // LIFE-CYCLE CALLBACKS: // onLoad () {}, start() { }, clickBtn() { var move1 = new cc.MoveBy(3, cc.v2(450, 0)); this.carModel.node.runAction(move1); var move2 = new cc.MoveBy(3, cc.v2(0, 350)); //this.carModel.node.runAction(move2); var move3 = new cc.MoveBy(3, cc.v2(-450, 0)); var move4 = new cc.MoveBy(3, cc.v2(0, -350)); var car = this.carModel; this.carModel.node.runAction(new cc.Sequence(move1, new cc.CallFunc(function() { cc.log("完成"); car.node.rotation = -450; car.node.runAction(new cc.Sequence(move2, new cc.CallFunc(function() { cc.log("完成2"); car.node.rotation = -180; car.node.runAction(new cc.Sequence(move3, new cc.CallFunc(function() { cc.log("完成3"); car.node.rotation = -270; car.node.runAction(new cc.Sequence(move4, new cc.CallFunc(function() { cc.log("完成4"); car.node.rotation = -360; }))); }))); }))); }))); }, // update (dt) {}, });
通过几天的学习感觉cocos的文档不太好,想做个小功能直接在文档很难找到你想要的。给的小案例新手不一定会用,感觉不够详细。我用过其他一些基于js开发的脚本控制器的文档比cocos的好,基本上一天就能上手。
想往游戏发展还是推荐unity3D,毕竟教程多。
标签:def img seq callbacks action xtend start this node
原文地址:https://www.cnblogs.com/codeDevotee/p/11163834.html