stop();var dep:Number = 0;hitMc_arr = ["xlzHit", "hqzHit", "xxzHit", "xhzHit", "dmzHit"];//要碰撞的mc实例名xlz_arr = [];//笑脸组的分数hqz_arr = [];//红旗组的分数xxz_arr = [];//略xhz_arr = [];//dmz_arr = [];////函数调用复制正(xlz,xlz_arr,xlz_txt);复制正(hqz,hqz_arr,hqz_txt);复制正(xxz,xxz_arr,xxz_txt);复制正(xhz,xhz_arr,xhz_txt);复制正(dmz,dmz_arr,dmz_txt);复制负(kf_mc);//函数定义function 复制正(mc, _arr, t){ mc.n = 0; mc.onRollOver = function() { this.n++; dep++; trace(dep); var newMc:MovieClip = this.duplicateMovieClip(this._name + this.n, dep); trace(newMc); 拖动(newMc,_arr,t); };}function 拖动(mc:MovieClip, _arr:Array, t:TextField){ mc.onPress = function() { this.startDrag(); }; mc.onRelease = mc.onReleaseOutside = function () { this.stopDrag(); //向分数数组中增加1 t.text = 计分(_arr, 10); };}function 复制负(mc){ mc.n = 0; mc.onRollOver = function() { this.n++; dep++; //trace(dep); var newMc:MovieClip = this.duplicateMovieClip(this._name + this.n, dep); //trace(newMc); 拖动负(newMc); };}function 拖动负(mc){ mc.onPress = function() { this.startDrag(); }; mc.onRelease = mc.onReleaseOutside = function () { this.stopDrag(); //向分数数组中增加1 碰撞(mc); };}function 计分(_arr:Array, fen:Number){ _arr.push(fen); //trace("分数数组是:" + _arr); temp = 0; for (var _i in _arr) { temp += _arr[_i]; } //trace("temp是" + temp); return temp;}function 碰撞(mc){if (mc.k == undefined){mc.k = 0;}mc.k++;for (var _i in hitMc_arr){if (mc.hitTest(_root[hitMc_arr[_i]])){//trace(_root[hitMc_arr[_i]] + "撞了");lb = _root[hitMc_arr[_i]]._name.substring(0, 3);if (mc.k == 1){//向分数数组中增加-1llb = _root[lb + "_arr"];lbt = _root[lb + "_txt"];//trace(lbt);lbt.text = 计分(llb, -10);}}}}
- 3 回答
- 0 关注
- 164 浏览
添加回答
举报
0/150
提交
取消