home *** CD-ROM | disk | FTP | other *** search
- function updateStickies(sticky)
- {
- if(++m_stickyNdx >= m_maxStickies)
- {
- m_stickyNdx = 0;
- }
- var _loc1_ = m_stickies[m_stickyNdx];
- _loc1_.unloadMovie();
- m_stickies[m_stickyNdx] = sticky;
- }
- function step()
- {
- if(hp_bar._alpha > 0)
- {
- hp_bar._alpha -= 5;
- }
- if(timeToTarget-- < 0)
- {
- m_target_x = random(_parent._parent.g_width);
- m_target_y = random(_parent._parent.g_ground);
- timeToTarget = 200;
- }
- 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.shootAtDragonProjectile(_X,_Y,2,"proj_enemy_ice");
- }
- }
- function updatePosition()
- {
- _X = _X + vx;
- _Y = _Y + vy;
- }
- function takeDamage(amt, xp, yp)
- {
- if(!killed)
- {
- hp -= amt;
- if(hp <= 0)
- {
- killed = true;
- hp = 0;
- var _loc3_ = _parent._parent.addObj("ammo_box_ice",_parent._parent.ammo_layer,_parent._parent.getNextAmmoLevel());
- _loc3_._x = _X;
- _loc3_._y = _Y;
- _parent._parent.addScore(400,_X,_Y);
- }
- else
- {
- hp_bar.bar._width = hp / max_hp * 100;
- hp_bar._alpha = 100;
- }
- if(_parent._parent.g_dmg_text_on)
- {
- 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;
- max_hp = Math.floor(50 * (1 + _parent._parent.g_level / 100));
- hp = max_hp;
- shootTimer = 300;
- etype = "ice";
- timeToTarget = 0;
- killed = false;
- var m_maxStickies = 3;
- var m_stickies = new Array(m_maxStickies);
- var m_stickyNdx = 0;
-