home *** CD-ROM | disk | FTP | other *** search
/ Champak 40 / Vol 40.iso / games / draw_pla.swf / scripts / frame_11 / DoAction.as
Encoding:
Text File  |  2007-05-10  |  1.1 KB  |  52 lines

  1. stop();
  2. _root.nono = false;
  3. _root.mtrue.bar = 500;
  4. _root.ground.moveTo(_xmouse,_ymouse);
  5. if(_root.medium == true)
  6. {
  7.    _root.mtrue.gotoAndStop(2);
  8. }
  9. _root.onMouseDown = function()
  10. {
  11.    if(_root.mtrue.bar > 0)
  12.    {
  13.       _root.ground.moveTo(_xmouse,_ymouse);
  14.       _root.ground.lineTo(_xmouse + 1,_ymouse + 1);
  15.       if(_root.medium == true)
  16.       {
  17.          _root.mtrue.bar -= 12;
  18.       }
  19.       _root.dist = 0;
  20.       _root.prevx = _xmouse;
  21.       _root.prevy = _ymouse;
  22.       mousedown = true;
  23.    }
  24. };
  25. _root.onMouseUp = function()
  26. {
  27.    if(_root.mtrue.bar > 0)
  28.    {
  29.       mousedown = false;
  30.    }
  31. };
  32. _root.onMouseMove = function()
  33. {
  34.    if(mousedown)
  35.    {
  36.       if(_root.mtrue.bar > 0)
  37.       {
  38.          _root.xdiff = prevx - _xmouse;
  39.          _root.ydiff = prevy - _ymouse;
  40.          _root.dist = Math.sqrt(xdiff * xdiff + ydiff * ydiff);
  41.          if(_root.medium == true)
  42.          {
  43.             _root.mtrue.bar -= _root.dist;
  44.          }
  45.          _root.dist = 0;
  46.          prevx = _xmouse;
  47.          prevy = _ymouse;
  48.          _root.ground.lineTo(_xmouse,_ymouse);
  49.       }
  50.    }
  51. };
  52.