home *** CD-ROM | disk | FTP | other *** search
- class fwg.Enemy extends MovieClip
- {
- var nR;
- var nSpeed_x;
- var nSpeed_y;
- var nMoment;
- var bFall;
- var nDir;
- var pTarget;
- var __nHealth;
- var mHealth;
- var nHealth_max;
- function Enemy()
- {
- super();
- this.nR = 0;
- this.nSpeed_x = 0;
- this.nSpeed_y = 0;
- this.nMoment = 0;
- this.bFall = true;
- this.nDir = 1;
- this.pTarget = Global.GAME.pKnight;
- Global.GAME.aEnemy.push(this);
- }
- function init()
- {
- }
- function get nHealth()
- {
- return this.__nHealth;
- }
- function set nHealth(_nHealth)
- {
- this.__nHealth = _nHealth;
- if(this.__nHealth <= 0)
- {
- this.mHealth._visible = false;
- }
- else
- {
- this.mHealth.mClip._xscale = this.__nHealth / this.nHealth_max * 100;
- }
- }
- function setPos_0()
- {
- this._y = (Game.getBetween(this._x,this._y,this._parent,Global.GAME.mClip.mMid) + this._y) / 2 - 1;
- }
- function setPos_2(_n)
- {
- var _loc3_ = Game.getBetween(this._x - _n,this._y,this._parent,Global.GAME.mClip.mMid);
- var _loc2_ = Game.getBetween(this._x + _n,this._y,this._parent,Global.GAME.mClip.mMid);
- this._y = (Game.getBetween(this._x,this._y,this._parent,Global.GAME.mClip.mMid) + this._y) / 2 - 1;
- this.nR = (Math.atan2(_loc3_ - _loc2_,_n * 2) + this.nR) / 2;
- }
- function falling()
- {
- if(this.bFall)
- {
- this.nSpeed_y += Game.nG;
- if(Game.hitGround(this._x,this._y + this.nSpeed_y,this._parent,Global.GAME.mClip.mMid))
- {
- this.bFall = false;
- this.nSpeed_y = 0;
- this.fallEnd();
- }
- else
- {
- this._y += this.nSpeed_y;
- }
- }
- }
- function fallEnd()
- {
- }
- function remove()
- {
- Common.removeArray(Global.GAME.aEnemy,this);
- }
- }
-