cocosCreate 黄金矿工绳索摆动,以及钩子的扔出和回收
2016-09-19 19:18
323 查看
this.startPos = this.rope.position; //记录起始位置 //绳子摇摆动作 this.shakeAction = cc.repeatForever(cc.sequence(cc.rotateTo(3,60),cc.rotateTo(3,-60))); // 回收钩子 //绳子收回动作,绳子收回后执行摇摆动作 this.returnAction = cc.sequence(cc.moveTo(3,this.startPos),cc.callFunc(function() { self.rope.getComponent(cc.Animation).resume('shake'); // 继续摇摆 }, this)); //绳子左右摇摆 this.rope.runAction(this.shakeAction); var self = this; this.node.on('touchstart',function(){ self.rope.getComponent(cc.Animation).pause('shake'); // 将摆动暂停 self.rope.stopAllActions(); //绳子伸长动作,根据角度动态计算 // var move1 = cc.moveBy(3,cc.p(-200*Math.tan(Math.PI/180*this.rope.rotation),-200)) // self.rope.runAction(cc.sequence(move1, cc.callFunc(this._callFun, this))); self.rope.runAction(cc.moveBy(2,-300*Math.tan(Math.PI/180*this.rope.rotation),-300)); //钩子扔出 },this); this.node.on('touchend',function(){ self.rope.runAction(self.returnAction); },this);
相关文章推荐
- Java 垃圾收集器以及回收策略及其始末
- JVM学习之:内存的分配以及回收
- 总结PHP内存释放以及垃圾回收
- 软件工程——黄金矿工
- BaseAdapter中重写getview的心得以及convertView回收的机制
- C# list存储的数据格式以及默认初始化空间,内存回收分析
- 使用WindowsAPI函数 以及使用钩子
- Android AdapterView 源码分析以及其相关回收机制的分析
- Android OOM以及让GC尽快回收的代码风格
- JVM内存管理、JVM垃圾回收机制、新生代、老年代以及永久代
- mongodb源码分析(十九)mongos的初始化以及连接池分配回收
- Java基础知识强化83:System类之gc()方法(垃圾回收)以及和finalize()区别
- BaseAdapter中重写getview的心得以及发现convertView回收的机制
- 【Cocos Creator 实战教程(4)】——黄金矿工(上)(节点动作、碰撞体相关)
- Java垃圾回收精粹——权衡点、对象生命周期以及全局暂停事件
- Android内存回收机制以及适配
- Java垃圾回收机制以及内存泄漏
- java垃圾回收算法以及垃圾收集器
- jvm的组成以及jvm的GC 垃圾回收算法分析
- 1.0Tinking In Java——初始化以及垃圾回收