home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / dtunnel.swf / scripts / frame_2 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  2.3 KB  |  91 lines

  1. _root.rover = new Sound(rover);
  2. _root.rover.attachSound("rover");
  3. _root.explode = new Sound(explode);
  4. _root.explode.attachSound("explode");
  5. _root.loop = new Sound(loop);
  6. _root.loop.attachSound("loop");
  7. _root.loopvolume = 100;
  8. _root.fade = "in";
  9. _root.gsc = "play";
  10. _root.display._visible = false;
  11. _root.score = "None";
  12. _root.stageheight = 220;
  13. _root.stagewidth = 400;
  14. _root.mycolor = "0x993300";
  15. _root.halfshipwidth = 10;
  16. _root.maxjaggyness = 30;
  17. _root.mintunnelwidth = 30;
  18. _root.minaddy = 20;
  19. _root.terrainarray = new Array();
  20. _root.coordinates = new Array();
  21. _root.loop.onSoundComplete = function()
  22. {
  23.    _root.loop.start(0,0);
  24. };
  25. _root.setup = function()
  26. {
  27.    _root.loop.stop();
  28.    _root.loop.start(0,0);
  29.    if(_root.gsc == "play")
  30.    {
  31.       _root.loopvolume = 100;
  32.       _root.fade = "in";
  33.    }
  34.    else if(_root.gsc == "stop")
  35.    {
  36.       _root.fade = "out";
  37.       _root.loopvolume = 0;
  38.    }
  39.    _root.loop.setVolume(_root.loopvolume);
  40.    _root.attachMovie("ship","ship",1);
  41.    _root.ship._y = _root.stageheight - 5;
  42.    _root.ship._x = _root.stagewidth / 2;
  43.    _root.attachMovie("terrain","terrain" + _root.depth,_root.depth);
  44.    _root.terrainarray[_root.terrainarray.length] = _root["terrain" + _root.depth];
  45.    if(_root.depth < 1000)
  46.    {
  47.       _root.depth = _root.depth + 1;
  48.    }
  49.    else
  50.    {
  51.       _root.depth = 5;
  52.    }
  53.    _root.addterrain = false;
  54.    _root.diesequence = false;
  55.    _root.display._visible = true;
  56.    _root.gameplay = true;
  57.    _root.score = 0;
  58.    _root.speed = 14;
  59.    _root.tspeed = 15;
  60.    _root.jaggyness = 10;
  61.    _root.tunnelwidth = 125;
  62.    _root.depth = 5;
  63.    _root.nextx = _root.stagewidth / 2 - _root.tunnelwidth / 2;
  64.    _root.addy = 50;
  65.    _root.deadcounter = 0;
  66.    _root.pausedelay = 0;
  67. };
  68. _root.clean = function()
  69. {
  70.    i = _root._root.terrainarray.length - 1;
  71.    while(i >= 0)
  72.    {
  73.       _root.terrainarray[i].removeMovieClip();
  74.       _root.terrainarray.splice(i,1);
  75.       i--;
  76.    }
  77.    i = _root._root.coordinates.length - 1;
  78.    while(i >= 0)
  79.    {
  80.       _root.coordinates[i].removeMovieClip();
  81.       _root.coordinates.splice(i,1);
  82.       i--;
  83.    }
  84.    _root.ship.removeMovieClip();
  85.    _root.explosion.removeMovieClip();
  86.    _root.youaredead = false;
  87.    _root.display._visible = false;
  88.    _root.gameplay = false;
  89.    _root.fade = "end";
  90. };
  91.