home *** CD-ROM | disk | FTP | other *** search
- temp = random(2);
- if(temp == 0)
- {
- player._y = 25;
- }
- else
- {
- player._y = 575;
- }
- player._x = 25 + random(650);
- driftSpeed = 0.01;
- circx = player._x;
- circy = player._y;
- prevx = _root.base._x;
- prevy = _root.base._y;
- angle = 0;
- degrees = 0;
- onEnterFrame = function()
- {
- if(circx < prevx && circy < prevy)
- {
- angle = Math.atan(Math.abs(circy - prevy) / Math.abs(circx - prevx));
- degrees = angle * 180 / 3.141592653589793;
- player._rotation = degrees + 90;
- }
- else if(circx < prevx && circy > prevy)
- {
- angle = Math.atan(Math.abs(circy - prevy) / Math.abs(circx - prevx));
- degrees = angle * 180 / 3.141592653589793;
- player._rotation = 90 - degrees;
- }
- else if(circx > prevx && circy < prevy)
- {
- angle = Math.atan(Math.abs(circx - prevx) / Math.abs(circy - prevy));
- degrees = angle * 180 / 3.141592653589793;
- player._rotation = - (180 - degrees);
- }
- else if(circx > prevx && circy > prevy)
- {
- angle = Math.atan(Math.abs(circy - prevy) / Math.abs(circx - prevx));
- degrees = angle * 180 / 3.141592653589793;
- player._rotation = - (90 - degrees);
- }
- circx = player._x;
- circy = player._y;
- prevx = _root._xmouse;
- prevy = _root._ymouse;
- player._x -= driftSpeed * ((player._x - _root.base._x) / 2);
- player._y -= driftSpeed * ((player._y - _root.base._y) / 2);
- if(Math.sqrt(Math.pow(circx - prevx,2) + Math.pow(circy - prevy,2)) >= 100)
- {
- player._x -= driftSpeed * 4 * ((player._x - _root.base._x) / 2);
- player._y -= driftSpeed * 4 * ((player._y - _root.base._y) / 2);
- }
- if(player.hitTest(_root.base))
- {
- _root.base.play();
- _root.life = _root.life - 1;
- }
- if(_root.life <= 0)
- {
- i = 0;
- while(i < 4)
- {
- e = _root.attachMovie("lineline11","l" + _root.k,_root.k++);
- e._x = player._x;
- e._y = player._y;
- i++;
- }
- this.removeMovieClip();
- }
- };
- onMouseDown = function()
- {
- if(player.hitTest(_root._xmouse,_root._ymouse))
- {
- _root.score += 650;
- _root.hitted.start();
- _root.kill = _root.kill + 1;
- i = 0;
- while(i < 10)
- {
- _root.attachMovie("lineline11","l" + _root.k,_root.k++);
- i++;
- }
- this.removeMovieClip();
- }
- };
-