home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Aventura / superman.swf / scripts / frame_77 / DoAction.as
Encoding:
Text File  |  2006-06-07  |  8.8 KB  |  369 lines

  1. player_x = MC_gameboard.MC_player._x;
  2. player_y = MC_gameboard.MC_player._y;
  3. player_frame = MC_gameboard.MC_player._currentframe;
  4. skyline_back_x = MC_gameboard.MC_skyline_back._x;
  5. skyline_front_x = MC_gameboard.MC_skyline_front._x;
  6. meteors_x = MC_gameboard.MC_meteors._x;
  7. level_display_x = MC_gameboard.MC_leveltext._x;
  8. meteorcounter++;
  9. if(dropdelay < meteorcounter)
  10. {
  11.    meteorcounter = 0;
  12.    r = random(16) + 1;
  13.    if(eval("MC_gameboard.MC_meteors.MC_meteor" add r)._currentframe == 1)
  14.    {
  15.       tmprnd = random(17) + 1;
  16.       tmpframe = 2;
  17.       if(_root.gLevel + 1 >= tmprnd)
  18.       {
  19.          tmpframe = 3;
  20.       }
  21.       eval("MC_gameboard.MC_meteors.MC_meteor" add r).gotoAndStop(tmpframe);
  22.       eval("MC_map.MC_meteors.MC_meteor" add r).gotoAndStop(tmpframe);
  23.    }
  24. }
  25. a = 1;
  26. while(a < 17)
  27. {
  28.    if(eval("MC_gameboard.MC_meteors.MC_meteor" add a)._currentframe == 19)
  29.    {
  30.       eval("MC_gameboard.MC_meteors.MC_meteor" add a)._y = 0;
  31.       eval("MC_map.MC_meteors.MC_meteor" add a)._y = 0;
  32.       eval("MC_map.MC_meteors.MC_meteor" add a).gotoAndStop(1);
  33.       eval("MC_gameboard.MC_meteors.MC_meteor" add a).gotoAndStop(1);
  34.    }
  35.    if(1 < eval("MC_gameboard.MC_meteors.MC_meteor" add a)._currentframe)
  36.    {
  37.       tmpy = eval("MC_gameboard.MC_meteors.MC_meteor" add a)._y + 3;
  38.       if(tmpy < 500)
  39.       {
  40.          eval("MC_gameboard.MC_meteors.MC_meteor" add a)._y = tmpy;
  41.          eval("MC_map.MC_meteors.MC_meteor" add a)._y = tmpy;
  42.       }
  43.       else
  44.       {
  45.          gOrig_x = MC_gameboard._x;
  46.          gOrig_y = MC_gameboard._y;
  47.          rattlecounter = 1;
  48.          eval("MC_gameboard.MC_meteors.MC_meteor" add a)._y = 0;
  49.          eval("MC_map.MC_meteors.MC_meteor" add a)._y = 0;
  50.          eval("MC_map.MC_meteors.MC_meteor" add a).gotoAndPlay(20);
  51.          eval("MC_gameboard.MC_meteors.MC_meteor" add a).gotoAndPlay(20);
  52.          missed += missscale;
  53.       }
  54.       if(MC_gameboard.MC_player.hitTest(eval("MC_gameboard.MC_meteors.MC_meteor" add a add ".MC_collission")))
  55.       {
  56.          tmptype = eval("MC_gameboard.MC_meteors.MC_meteor" add a)._currentframe;
  57.          tmpframe = MC_gameboard.MC_player.MC_heat_vision._currentframe;
  58.          if(tmptype == 2)
  59.          {
  60.             _root.gScore += 50;
  61.             eval("MC_gameboard.MC_meteors.MC_meteor" add a).gotoAndPlay(7);
  62.             eval("MC_map.MC_meteors.MC_meteor" add a).gotoAndPlay(7);
  63.             collected++;
  64.          }
  65.          if(tmptype == 3)
  66.          {
  67.             if(14 < player_frame && player_frame < 26 || 69 < player_frame && player_frame < 81)
  68.             {
  69.                _root.gScore += 100;
  70.                eval("MC_gameboard.MC_meteors.MC_meteor" add a).gotoAndPlay(7);
  71.                eval("MC_map.MC_meteors.MC_meteor" add a).gotoAndPlay(7);
  72.                collected++;
  73.             }
  74.             else
  75.             {
  76.                eval("MC_gameboard.MC_meteors.MC_meteor" add a).gotoAndPlay(31);
  77.                if(facing == 0)
  78.                {
  79.                   MC_gameboard.MC_player.gotoAndPlay(24);
  80.                }
  81.                else
  82.                {
  83.                   MC_gameboard.MC_player.gotoAndPlay(83);
  84.                }
  85.                if(0 < speed)
  86.                {
  87.                   speed = 5;
  88.                }
  89.                else
  90.                {
  91.                   speed = -5;
  92.                }
  93.                hitcounter = 30;
  94.                health -= hit_damage;
  95.             }
  96.          }
  97.       }
  98.    }
  99.    a++;
  100. }
  101. if(0 < rattlecounter)
  102. {
  103.    rattlecounter++;
  104.    tmprnd = 4 >= random(10) ? -1 : 1;
  105.    MC_gameboard._x = gOrig_x + random(10) * tmprnd;
  106.    MC_gameboard._y = gOrig_y + random(10) * tmprnd;
  107. }
  108. if(10 < rattlecounter)
  109. {
  110.    rattlecounter = 0;
  111.    MC_gameboard._x = gOrig_x;
  112.    MC_gameboard._y = gOrig_y;
  113. }
  114. a = 0;
  115. while(a < 5)
  116. {
  117.    if(speed < xgoal)
  118.    {
  119.       speed += 1;
  120.    }
  121.    if(xgoal < speed)
  122.    {
  123.       speed -= 1;
  124.    }
  125.    a++;
  126. }
  127. player_x += speed;
  128. a = 0;
  129. while(a < 3)
  130. {
  131.    if(ygoal < altitude)
  132.    {
  133.       altitude--;
  134.    }
  135.    if(altitude < ygoal)
  136.    {
  137.       altitude++;
  138.    }
  139.    a++;
  140. }
  141. player_y += altitude;
  142. if(player_y < 120)
  143. {
  144.    player_y = 120;
  145. }
  146. if(360 < player_y)
  147. {
  148.    player_y = 360;
  149. }
  150. if(300 < player_x)
  151. {
  152.    player_x = 300;
  153.    skyline_back_x -= Math.abs(speed) / 2;
  154.    skyline_front_x -= Math.abs(speed);
  155.    meteors_x -= speed;
  156.    level_display_x -= speed;
  157. }
  158. if(player_x < 240)
  159. {
  160.    player_x = 240;
  161.    skyline_back_x -= speed / 2;
  162.    skyline_front_x -= speed;
  163.    meteors_x -= speed;
  164.    level_display_x -= speed;
  165. }
  166. if(skyline_back_x < -1139)
  167. {
  168.    skyline_back_x = 0;
  169. }
  170. if(0 < skyline_back_x)
  171. {
  172.    skyline_back_x = -1139;
  173. }
  174. if(skyline_front_x < -1459)
  175. {
  176.    skyline_front_x = 0;
  177. }
  178. if(0 < skyline_front_x)
  179. {
  180.    skyline_front_x = -1459;
  181. }
  182. if(meteors_x < -2535)
  183. {
  184.    meteors_x = 0;
  185. }
  186. if(0 < meteors_x)
  187. {
  188.    meteors_x = -2535;
  189. }
  190. MC_map.MC_player._x = 15 - MC_gameboard.MC_meteors._x / 9;
  191. MC_map.MC_player._y = 10 + player_y / 10;
  192. if(1 < health)
  193. {
  194.    MC_health_bar.gotoAndStop(50 - health);
  195. }
  196. MC_gameboard.MC_player._x = player_x;
  197. MC_gameboard.MC_player._y = player_y;
  198. if(rattlecounter == 0)
  199. {
  200.    MC_gameboard.MC_skyline_back._x = skyline_back_x;
  201.    MC_gameboard.MC_skyline_front._x = skyline_front_x;
  202.    MC_gameboard.MC_meteors._x = meteors_x;
  203. }
  204. displayScore(true);
  205. MC_missed.gotoAndStop(missed + 1);
  206. MC_gameboard.MC_leveltext._x = level_display_x;
  207. hitcounter--;
  208. if(hitcounter == 1)
  209. {
  210.    setdir = facing;
  211. }
  212. keycounter = 0;
  213. if(hitcounter < 1)
  214. {
  215.    checkcounter = 0;
  216.    if(Key.isDown(81))
  217.    {
  218.       _root.gotoAndPlay("GameOver");
  219.    }
  220.    if((Key.isDown(Key.Right) || setdir == 0) && keycounter == 0)
  221.    {
  222.       keycounter++;
  223.       setdir = -1;
  224.       xgoal = 18;
  225.       facing = 0;
  226.       if(55 < MC_gameboard.MC_player._currentframe)
  227.       {
  228.          MC_gameboard.MC_player.gotoAndPlay(1);
  229.          MC_map.MC_player.gotoAndPlay(1);
  230.       }
  231.    }
  232.    else
  233.    {
  234.       checkcounter++;
  235.    }
  236.    if((Key.isDown(Key.Left) || setdir == 2) && keycounter == 0)
  237.    {
  238.       keycounter++;
  239.       setdir = -1;
  240.       xgoal = -18;
  241.       facing = 1;
  242.       if(MC_gameboard.MC_player._currentframe < 56)
  243.       {
  244.          MC_gameboard.MC_player.gotoAndPlay(56);
  245.          MC_map.MC_player.gotoAndPlay(56);
  246.       }
  247.    }
  248.    else
  249.    {
  250.       checkcounter++;
  251.    }
  252.    if(Key.isDown(Key.Shift))
  253.    {
  254.       if(facing == 0)
  255.       {
  256.          xgoal = 46;
  257.       }
  258.       else
  259.       {
  260.          xgoal = -46;
  261.       }
  262.    }
  263.    else
  264.    {
  265.       if(facing == 0)
  266.       {
  267.          xgoal = 22;
  268.       }
  269.       else if(facing == 1)
  270.       {
  271.          xgoal = -22;
  272.       }
  273.       checkcounter++;
  274.    }
  275.    if(Key.isDown(Key.Down) && keycounter == 0)
  276.    {
  277.       keycounter++;
  278.       if(facing == 0)
  279.       {
  280.          if(player_frame < 11 || 13 < player_frame)
  281.          {
  282.             MC_gameboard.MC_player.gotoAndPlay(11);
  283.             MC_map.MC_player.gotoAndPlay(11);
  284.          }
  285.       }
  286.       else if(player_frame < 66 || 69 < player_frame)
  287.       {
  288.          MC_gameboard.MC_player.gotoAndPlay(66);
  289.          MC_map.MC_player.gotoAndPlay(66);
  290.       }
  291.       ygoal = 12;
  292.    }
  293.    else if(Key.isDown(Key.Up) && keycounter == 0)
  294.    {
  295.       keycounter++;
  296.       if(facing == 0)
  297.       {
  298.          if(player_frame < 7 || 10 < player_frame)
  299.          {
  300.             MC_gameboard.MC_player.gotoAndPlay(7);
  301.             MC_map.MC_player.gotoAndPlay(7);
  302.          }
  303.       }
  304.       else if(player_frame < 62 || 64 < player_frame)
  305.       {
  306.          MC_gameboard.MC_player.gotoAndPlay(62);
  307.          MC_map.MC_player.gotoAndPlay(62);
  308.       }
  309.       ygoal = -12;
  310.    }
  311.    else
  312.    {
  313.       checkcounter++;
  314.       ygoal = 0;
  315.    }
  316.    if(Key.isDown(Key.Space) && keycounter == 0)
  317.    {
  318.       keycounter++;
  319.       if(facing == 0)
  320.       {
  321.          if(player_frame < 15 || 35 < player_frame)
  322.          {
  323.             MC_gameboard.MC_player.gotoAndPlay(15);
  324.             MC_map.MC_player.gotoAndPlay(15);
  325.          }
  326.          xgoal = 4;
  327.       }
  328.       else
  329.       {
  330.          if(player_frame < 70 || 90 < player_frame)
  331.          {
  332.             MC_gameboard.MC_player.gotoAndPlay(70);
  333.             MC_map.MC_player.gotoAndPlay(70);
  334.          }
  335.          xgoal = -4;
  336.       }
  337.       heatdelay = 5;
  338.    }
  339.    else
  340.    {
  341.       if(facing == 0)
  342.       {
  343.          if(14 < player_frame && player_frame < 36)
  344.          {
  345.             MC_gameboard.MC_player.gotoAndPlay(5);
  346.             MC_map.MC_player.gotoAndPlay(5);
  347.          }
  348.       }
  349.       else if(69 < player_frame && player_frame < 91)
  350.       {
  351.          MC_gameboard.MC_player.gotoAndPlay(60);
  352.          MC_map.MC_player.gotoAndPlay(60);
  353.       }
  354.       checkcounter++;
  355.       heatdelay--;
  356.    }
  357.    if(checkcounter == 5)
  358.    {
  359.       if(facing == 0)
  360.       {
  361.          MC_gameboard.MC_player.gotoAndPlay(5);
  362.       }
  363.       else
  364.       {
  365.          MC_gameboard.MC_player.gotoAndPlay(60);
  366.       }
  367.    }
  368. }
  369.