home *** CD-ROM | disk | FTP | other *** search
- function step()
- {
- m_target_x = _parent._parent.dragon_head._x;
- m_target_y = _parent._parent.dragon_head._y;
- var _loc2_ = 2;
- if(!isDead())
- {
- updateCannon();
- if(m_target_x > _X && vx < _loc2_)
- {
- vx += 0.05;
- }
- else if(m_target_x < _X && vx > - _loc2_)
- {
- vx -= 0.05;
- }
- if(m_target_y > _Y && vy < _loc2_)
- {
- vy += 0.02;
- }
- else if(m_target_y < _Y && vy > - _loc2_)
- {
- vy -= 0.02;
- }
- if(vx > 0)
- {
- _xscale = -100;
- }
- else
- {
- _xscale = 100;
- }
- }
- else
- {
- vy += 0.08;
- _rotation = _rotation - 0.2;
- }
- updatePosition();
- if(_Y > _parent._parent.g_ground + 100)
- {
- destroy();
- }
- }
- function updateCannon()
- {
- if(shootTimer-- < 0)
- {
- shootTimer = 300;
- _parent._parent.shootAtDragon(_X,_Y,2);
- }
- }
- function updatePosition()
- {
- _X = _X + vx;
- _Y = _Y + vy;
- }
- function takeDamage(amt, xp, yp)
- {
- hp -= amt;
- if(hp < 0)
- {
- hp = 0;
- }
- var _loc2_ = _parent._parent.addObj("dmg_text",_parent._parent.score_layer,_parent._parent.getNextScoreLevel());
- _loc2_._x = xp;
- _loc2_._y = yp;
- _loc2_.val = amt;
- }
- function isDead()
- {
- return hp == 0;
- }
- function setHP(num)
- {
- hp = num;
- }
- function destroy()
- {
- _parent._parent.removeEnemy(this);
- }
- m_target_x = 0;
- m_target_y = 0;
- vx = -0.6;
- vy = 0;
- hp = 2;
- shootTimer = 300;
- etype = "dragon_archer";
-