home *** CD-ROM | disk | FTP | other *** search
- range = 300;
- xs = 3;
- xmin = _X;
- xmax = _X + range;
- _xscale = -100;
- hd = 1;
- attacking = 0;
- onenterframe = function()
- {
- if(!attacking)
- {
- _X = _X + xs;
- if(_X > xmax)
- {
- _X = xmax;
- xs = - xs;
- _xscale = 100;
- hd = 2;
- }
- else if(_X < xmin)
- {
- _X = xmin;
- xs = - xs;
- _xscale = -100;
- hd = 1;
- }
- if(p._y <= _Y + 10 and p._y > _Y - 150)
- {
- dx = _X - p._x;
- if(math.abs(dx) < 100)
- {
- if(hd == 1 and dx < 0 or hd == 2 and dx > 0)
- {
- attacking = 1;
- d = 20;
- t.gotoAndStop("attack");
- }
- }
- }
- }
- else
- {
- d--;
- if(d < 15)
- {
- cekhitp(this);
- }
- if(!d)
- {
- attacking = 0;
- t.gotoAndStop("walk");
- }
- }
- cekhitattack(z);
- if(die)
- {
- if(hd == 1 and dx < 0 or hd == 2 and dx > 0)
- {
- die = 0;
- cekhitp(this);
- attacking = 1;
- d = 20;
- t.gotoAndStop("attack");
- }
- else
- {
- gotoAndPlay(2);
- }
- }
- };
- stop();
-