然后是两个宝物的CLASS,继承了金币的类,只不过改写了被人物吃到后的效果
爱心
class items.Bao1 extends items.Jin { public function getItem() { _root.music_control.snd("bao"); depth = _root.xs.getNextHighestDepth(); var a:MovieClip = _root.xs.attachMovie("getScore", "getScore"+depth, depth++); a.aaa.score = "TIME"; a._x = _x; a._y = _y; //////// _root.time_c._time += 8; ///////调时间控制类的public方法,后面会讲到 this.removeMovieClip(); } }
五角星
class items.Bao2 extends items.Jin { public var score:Number = 30; public function getItem() { //_root.score+=score _root.music_control.snd("bao"); /////// for (var i in _root.item) { if (_root.item[i]._name.substr(0, 3) != "bao") { _root.item[i].getItem(); } } _root.score += score; depth = _root.xs.getNextHighestDepth(); var a:MovieClip = _root.xs.attachMovie("getScore", "getScore"+depth, depth++); a.aaa.score = "+"+score; a._x = _x; a._y = _y; /////// this.removeMovieClip(); } }
|