home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Nave / dragonforce.swf / scripts / frame_2 / DoAction_9.as < prev    next >
Encoding:
Text File  |  2006-06-13  |  1.4 KB  |  63 lines

  1. _root.getkey = function()
  2. {
  3.    var k = Key.isDown;
  4.    kleft = k(_root.leftkey);
  5.    kright = k(_root.rightkey);
  6.    kup = k(_root.upkey);
  7.    kdown = k(_root.downkey);
  8.    kspace = k(_root.firekey);
  9.    if(kup)
  10.    {
  11.       _root.ship._y -= _root.speed;
  12.       if(_root.ship._y < _root.top_border)
  13.       {
  14.          _root.ship._y = _root.top_border;
  15.       }
  16.    }
  17.    if(kdown)
  18.    {
  19.       _root.ship._y += _root.speed;
  20.       if(_root.ship._y > _root.bottom_border)
  21.       {
  22.          _root.ship._y = _root.bottom_border;
  23.       }
  24.    }
  25.    if(kright)
  26.    {
  27.       _root.ship._x += _root.speed;
  28.       if(_root.ship._x > _root.right_border)
  29.       {
  30.          _root.ship._x = _root.right_border;
  31.       }
  32.    }
  33.    if(kleft)
  34.    {
  35.       _root.ship._x -= _root.speed;
  36.       if(_root.ship._x < _root.left_border)
  37.       {
  38.          _root.ship._x = _root.left_border;
  39.       }
  40.    }
  41.    _root.firetimer = _root.firetimer + 1;
  42.    if(kspace && _root.firetimer >= _root.interval)
  43.    {
  44.       if(_root.weapontype == "red")
  45.       {
  46.          _root.redsound.stop();
  47.          _root.redsound.start(0,0);
  48.       }
  49.       else if(_root.weapontype == "blue")
  50.       {
  51.          _root.bluesound.stop();
  52.          _root.bluesound.start(0,0);
  53.       }
  54.       else if(_root.weapontype == "green")
  55.       {
  56.          _root.greensound.stop();
  57.          _root.greensound.start(0,0);
  58.       }
  59.       _root[_root.weapontype + _root.weaponnumber]();
  60.       _root.firetimer = 0;
  61.    }
  62. };
  63.