home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / rocketcar2.swf / scripts / DefineSprite_79_bomb3 / frame_1 / DoAction.as
Encoding:
Text File  |  2008-09-24  |  1.1 KB  |  54 lines

  1. x = 100;
  2. y = 150;
  3. xb = -6;
  4. yb = 6;
  5. _xscale = Math.round(Math.random() * (y - x)) + x;
  6. _yscale = _xscale;
  7. xspeed = Math.round(Math.random() * (yb - xb)) + xb;
  8. switch(type)
  9. {
  10.    case "slow":
  11.       if(_root.sound)
  12.       {
  13.          sound = new Sound(this);
  14.          sound.attachSound("energyballs");
  15.          sound.setVolume(60);
  16.          sound.start();
  17.       }
  18.       speed = 2;
  19.       break;
  20.    default:
  21.       if(_root.sound)
  22.       {
  23.          sound = new Sound(this);
  24.          sound.attachSound("bigball");
  25.          sound.setVolume(60);
  26.          sound.start();
  27.       }
  28.    case "homing":
  29.       speed = random(4) + 2;
  30. }
  31. time = random(60);
  32. m = random(20);
  33. if(type == "homing")
  34. {
  35.    if(_root.sound)
  36.    {
  37.       sound = new Sound(this);
  38.       sound.attachSound("energyballs");
  39.       sound.setVolume(60);
  40.       sound.start();
  41.    }
  42.    lol = random(2);
  43.    if(lol == 0)
  44.    {
  45.       this.removeMovieClip();
  46.    }
  47.    shotSpeed = 5;
  48.    deltaX = _X - _root.car._x;
  49.    deltaY = _Y - _root.car._y;
  50.    angle = - Math.atan2(deltaX,deltaY);
  51.    ySpeed = shotSpeed * Math.cos(angle);
  52.    xSpeed = shotSpeed * Math.sin(angle);
  53. }
  54.