home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / levita.swf / scripts / frame_5 / DoAction.as < prev   
Encoding:
Text File  |  2005-08-23  |  1.5 KB  |  69 lines

  1. t = Number(t) + 0.1;
  2. oldx = x;
  3. oldy = y;
  4. x = getProperty("Nau", _X);
  5. y = getProperty("Nau", _Y);
  6. if(Key.isDown(Key.UP) and 0 < _root.fuel and _root.fi == 0)
  7. {
  8.    x = Number(x) + Number(vx / 10);
  9.    y = Number(y) + Number(vy / 10);
  10.    if(Number(y) < Number(BallRadius))
  11.    {
  12.       y = BallRadius;
  13.       vx *= elastic;
  14.       vy = - vy * elastic;
  15.    }
  16.    if(Number(400 - BallRadius) < Number(y))
  17.    {
  18.       y = 400 - BallRadius;
  19.       vx *= elastic;
  20.       vy = - vy * elastic;
  21.    }
  22.    if(Number(x) < Number(BallRadius))
  23.    {
  24.       x = BallRadius;
  25.       vx = - vx * elastic;
  26.       vy *= elastic;
  27.    }
  28.    if(Number(600 - BallRadius) < Number(x))
  29.    {
  30.       x = 600 - BallRadius;
  31.       vx = - vx * elastic;
  32.       vy *= elastic;
  33.    }
  34.    setProperty("Nau", _X, x);
  35.    setProperty("Nau", _Y, y);
  36. }
  37. else
  38. {
  39.    vy = Number(vy) + Number(g / 10);
  40.    x = Number(x) + Number(vx / 10);
  41.    y = Number(y) + Number(vy / 10);
  42.    if(Number(y) < Number(BallRadius))
  43.    {
  44.       y = BallRadius;
  45.       vx *= elastic;
  46.       vy = - vy * elastic;
  47.    }
  48.    if(Number(400 - BallRadius) < Number(y))
  49.    {
  50.       y = 400 - BallRadius;
  51.       vx *= elastic;
  52.       vy = - vy * elastic;
  53.    }
  54.    if(Number(x) < Number(BallRadius))
  55.    {
  56.       x = BallRadius;
  57.       vx = - vx * elastic;
  58.       vy *= elastic;
  59.    }
  60.    if(Number(600 - BallRadius) < Number(x))
  61.    {
  62.       x = 600 - BallRadius;
  63.       vx = - vx * elastic;
  64.       vy *= elastic;
  65.    }
  66.    setProperty("Nau", _X, x);
  67.    setProperty("Nau", _Y, y);
  68. }
  69.