home *** CD-ROM | disk | FTP | other *** search
- class Class.Role extends MovieClip
- {
- var _life;
- var life;
- var damage;
- var hurtObj;
- var opp;
- var mc;
- var onEnterFrame;
- var x;
- var isCPU = false;
- var inLose = false;
- function Role()
- {
- super();
- this._life = 100;
- this.life = this._life;
- this.damage = 50;
- this.hurtObj = new Object();
- }
- function init(_opp)
- {
- this.opp = _opp;
- }
- function setReady()
- {
- this.gotoAndStop("ready");
- }
- function setStand()
- {
- this.gotoAndStop("stand");
- }
- function setAnimation(powerRate)
- {
- var _loc2_ = int(powerRate * this.mc._totalframes) + 1;
- if(_loc2_ > this.mc._totalframes)
- {
- _loc2_ = this.mc._totalframes;
- }
- this.mc.gotoAndStop(_loc2_);
- }
- function startShoot()
- {
- trace("startShoot: " + this.startShoot);
- this.gotoAndPlay("shoot");
- _root.soundStart("shoot1_snd");
- }
- function hit(type, damageRate)
- {
- this.gotoAndPlay("h" + type);
- this.hurtObj["hurt" + type] = true;
- this.life -= int(this.damage * damageRate - Math.random() * 4);
- if(this.life < 0)
- {
- this.life = 0;
- }
- _root.UI_mc.setHP(this,this.life);
- if(this.isCPU && this.opp.isCPU != true)
- {
- _root.setScore(int(100 * damageRate),"vs");
- }
- if(this.life <= 0)
- {
- this.lose();
- }
- _root.soundStart("hit1_snd");
- }
- function checkHurt(mc)
- {
- if(this.hurtObj[mc._name] == true)
- {
- mc._visible = true;
- }
- }
- function lose()
- {
- this.inLose = true;
- this.gotoAndStop("lose");
- }
- function hitBack(Vx)
- {
- this.onEnterFrame = function()
- {
- this.x += Vx;
- Vx *= 0.9;
- _root.mc.make3D(this);
- if(Vx < 1)
- {
- delete this.onEnterFrame;
- }
- };
- }
- }
-