home *** CD-ROM | disk | FTP | other *** search
/ Online Today 2002 April / OTODAY042002.ISO / pc / progwin / lighths.swf / scripts / frame_6981 / DoAction.as
Encoding:
Text File  |  2001-08-13  |  4.5 KB  |  225 lines

  1. if(kollision == 0)
  2. {
  3.    if(Key.isDown(Key.UP) and key_aktiv == 1 or Key.isDown(Key.DOWN) and key_aktiv == 1)
  4.    {
  5.       key_aktiv = 1;
  6.    }
  7.    else
  8.    {
  9.       key_aktiv = 0;
  10.    }
  11.    if(key_aktiv == 0)
  12.    {
  13.       if(Key.isDown(Key.DOWN))
  14.       {
  15.          if(speed >= -15)
  16.          {
  17.             speed -= 25;
  18.          }
  19.          key_aktiv = 1;
  20.       }
  21.       if(Key.isDown(Key.UP))
  22.       {
  23.          if(speed < 75)
  24.          {
  25.             speed += 25;
  26.          }
  27.          key_aktiv = 1;
  28.       }
  29.    }
  30. }
  31. if(kollision == 0)
  32. {
  33.    if(Key.isDown(Key.RIGHT))
  34.    {
  35.       winkel += 1.5;
  36.    }
  37.    if(Key.isDown(Key.LEFT))
  38.    {
  39.       winkel -= 1.5;
  40.    }
  41. }
  42. showwinkel = winkel;
  43. if(schiffspeed < speed)
  44. {
  45.    schiffspeed += 1;
  46. }
  47. else if(speed < schiffspeed)
  48. {
  49.    schiffspeed -= 1;
  50. }
  51. else
  52. {
  53.    schiffspeed = speed;
  54. }
  55. if(schiffwinkel < winkel)
  56. {
  57.    schiffwinkel += (winkel - schiffwinkel) / 25;
  58. }
  59. else if(winkel < schiffwinkel)
  60. {
  61.    schiffwinkel += (winkel - schiffwinkel) / 25;
  62. }
  63. showschiffwinkel = schiffwinkel;
  64. while(showschiffwinkel < 0)
  65. {
  66.    showschiffwinkel += 360;
  67. }
  68. while(showschiffwinkel >= 360)
  69. {
  70.    showschiffwinkel -= 360;
  71. }
  72. while(showwinkel < 0)
  73. {
  74.    showwinkel += 360;
  75. }
  76. while(showwinkel >= 360)
  77. {
  78.    showwinkel -= 360;
  79. }
  80. i = 1;
  81. while(55 >= i)
  82. {
  83.    if(_root.schiff.vorne.hittest("_root.eisberg" add i))
  84.    {
  85.       kollision = 1;
  86.       if(kollision != 0)
  87.       {
  88.          schadenspeed = schiffspeed / 2;
  89.          schiffspeed = -20;
  90.          speed = 0;
  91.       }
  92.    }
  93.    else
  94.    {
  95.       kollision = 0;
  96.    }
  97.    if(_root.schiff.links.hittest("_root.eisberg" add i))
  98.    {
  99.       kollision = 2;
  100.       if(kollision != 0)
  101.       {
  102.          schadenspeed = schiffspeed / 3;
  103.          schiffspeed = -20;
  104.          speed = 0;
  105.       }
  106.    }
  107.    else
  108.    {
  109.       kollision = 0;
  110.    }
  111.    if(_root.schiff.rechts.hittest("_root.eisberg" add i))
  112.    {
  113.       kollision = 3;
  114.       if(kollision != 0)
  115.       {
  116.          schadenspeed = schiffspeed / 3;
  117.          schiffspeed = -20;
  118.          speed = 0;
  119.       }
  120.       else
  121.       {
  122.          kollision = 0;
  123.       }
  124.    }
  125.    if(_root.schiff.hintenlinks.hittest("_root.eisberg" add i))
  126.    {
  127.       kollision = 4;
  128.       if(kollision != 0)
  129.       {
  130.          schadenspeed = schiffspeed / 4;
  131.          winkel -= 2;
  132.          schiffspeed = 10;
  133.       }
  134.       else
  135.       {
  136.          kollision = 0;
  137.       }
  138.    }
  139.    if(_root.schiff.hintenrechts.hittest("_root.eisberg" add i))
  140.    {
  141.       kollision = 5;
  142.       if(kollision != 0)
  143.       {
  144.          schadenspeed = schiffspeed / 4;
  145.          winkel += 2;
  146.          schiffspeed = 10;
  147.       }
  148.       else
  149.       {
  150.          kollision = 0;
  151.       }
  152.    }
  153.    i++;
  154. }
  155. if(schadenspeed < 0)
  156. {
  157.    schaden += schadenspeed - schadenspeed - schadenspeed;
  158. }
  159. else
  160. {
  161.    schaden += schadenspeed;
  162. }
  163. if(schaden >= 100)
  164. {
  165.    schaden = 100;
  166.    gotoAndPlay(7016);
  167. }
  168. schadenspeed = 0;
  169. if(speed < 0)
  170. {
  171.    diesel += speed * 2;
  172. }
  173. else
  174. {
  175.    diesel -= speed * 2;
  176. }
  177. if(0 >= diesel)
  178. {
  179.    gotoAndPlay(6996);
  180. }
  181. sin = Math.sin(0.017453292519943295 * schiffwinkel);
  182. cos = Math.cos(0.017453292519943295 * schiffwinkel);
  183. xschiff = xschiff + schiffspeed * sin / 20 + xstroemung;
  184. yschiff = yschiff + schiffspeed * (cos - cos - cos) / 20 + ystroemung;
  185. if(yschiff < -50 or 450 < yschiff or xschiff < 0 or 550 < xschiff)
  186. {
  187.    gotoAndPlay(7006);
  188. }
  189. if(_root.schiff.vorne.hittest(_root.exit))
  190. {
  191.    gotoAndStop(7027);
  192. }
  193. if(yschiff < 120 and background < 700)
  194. {
  195.    background += background_schritt;
  196.    yschiff += background_schritt;
  197.    i = 1;
  198.    while(55 >= i)
  199.    {
  200.       setProperty("_root.eisberg" add i, _Y, getProperty("_root.eisberg" add i, _Y) + background_schritt);
  201.       i++;
  202.    }
  203.    setProperty(_root.exit, _Y, getProperty(_root.exit, _Y) + background_schritt);
  204. }
  205. if(300 < yschiff and -300 < background)
  206. {
  207.    background -= background_schritt;
  208.    yschiff -= background_schritt;
  209.    i = 1;
  210.    while(55 >= i)
  211.    {
  212.       setProperty("_root.eisberg" add i, _Y, getProperty("_root.eisberg" add i, _Y) - background_schritt);
  213.       i++;
  214.    }
  215.    setProperty(_root.exit, _Y, getProperty(_root.exit, _Y) - background_schritt);
  216. }
  217. setProperty("_root.schiff", _rotation, showwinkel);
  218. setProperty("_root.schiff", _X, xschiff);
  219. setProperty("_root.schiff", _Y, yschiff);
  220. setProperty("_root.speed", _yscale, schiffspeed);
  221. setProperty("_root.speedregler", _Y, speed - speed - speed + 355);
  222. setProperty("_root.background", _Y, background);
  223. setProperty("_root.diesel", _yscale, diesel / 100000 * 100);
  224. setProperty("_root.schaden", _yscale, schaden);
  225.