var BattleLayer = cc.LayerColor.extend({ _battleList: [], //存储章节列表 ctor: function () { this._super(cc.color(220, 220, 220, 255)); this.initCard(); }, initCard: function () { for (var i = 1; i < 5; i++) { var posX = 100 + 100 * i; var pos = cc.p(posX, GC.h_2); //选关正面 var front = new cc.Sprite(res.ba_card_gates_png); front.setPosition(pos); front.setVisible(false); //设置正面隐藏 this.addChild(front, 0, -i); //章节介绍 var back = new cc.Sprite('res/battle/card_' + i + '.png'); back.setPosition(pos); this.addChild(back, 0, i); var listener = cc.EventListener.create({ event: cc.EventListener.TOUCH_ONE_BY_ONE,……
var jian = new cc.Sprite("#images/gongjianshou/jian.png"); jian.attr({ x: this.x, y: this.y + 100, scaleY: this.scaleY, scaleX: -Math.abs(this.scaleX) }); jian.setName('jian'); this.parent.addChild(jian, 30); //抛物线飞行 var sx = jian.x; //开始位置x var sy = jian.y; //开始位置y var ex = target.x + 40; //结束位置x var ey = target.y + 150; //结束位置y var startA = this.scaleX > 0 ? 130 : 40; //起始角度 var endA = this.scaleX > 0 ? 220 :……