home *** CD-ROM | disk | FTP | other *** search
/ Champak 35 / jogo-disk-35.iso / Games / red_beard.swf / scripts / DefineSprite_102 / frame_1 / DoAction.as
Text File  |  2007-02-27  |  4KB  |  81 lines

  1. if(eval("_root.codeMC:state") != "dead")
  2. {
  3.    range = 10;
  4.    if(getProperty("_root.playerMC", _Y) > _Y + getProperty("_root.BackgroundMC", _Y) - range and getProperty("_root.playerMC", _Y) < _Y + getProperty("_root.BackgroundMC", _Y) + range)
  5.    {
  6.       inRange = "on";
  7.    }
  8.    else
  9.    {
  10.       inrange = "off";
  11.    }
  12.    if(getProperty("_root.playerMC", _Y) < _Y + getProperty("_root.BackgroundMC", _Y) and getProperty("_root.playerMC", _Y) + eval("_root.CodeMC:fallspeed") > _Y + getProperty("_root.BackgroundMC", _Y))
  13.    {
  14.       yCollision = "on";
  15.    }
  16.    else
  17.    {
  18.       yCollision = "off";
  19.    }
  20.    if(getProperty("_root.playerMC", _X) > _X + getProperty("_root.BackgroundMC", _X) and getProperty("_root.playerMC", _X) < _X + _width + getProperty("_root.BackgroundMC", _X))
  21.    {
  22.       xCollision = "on";
  23.    }
  24.    else
  25.    {
  26.       xCollision = "off";
  27.    }
  28.    if(inRange == "on" and xCollision == "on")
  29.    {
  30.       if(collision != "on")
  31.       {
  32.          set("_root.CodeMC:platformActive",eval("_root.CodeMC:platformActive") + 1);
  33.       }
  34.       collision = "on";
  35.       set("_root.CodeMC:currentGround",_Y + getProperty("_root.BackgroundMC", _Y));
  36.       if(eval("_root.codeMC:jumping") == "off")
  37.       {
  38.          setProperty("_root.playerMC", _Y, _Y + getProperty("_root.BackgroundMC", _Y));
  39.       }
  40.       if(getProperty("_root.playerMC", _Y) > eval("_root.codeMC:scrollPointLower"))
  41.       {
  42.          setProperty("_root.backgroundMC", _Y, getProperty("_root.backgroundMC", _Y) - getProperty("_root.playerMC", _Y) + eval("_root.codeMC:scrollPointLower"));
  43.       }
  44.       if(getProperty("_root.playerMC", _Y) < eval("_root.codeMC:scrollPointUpper"))
  45.       {
  46.          setProperty("_root.backgroundMC", _Y, getProperty("_root.backgroundMC", _Y) - getProperty("_root.playerMC", _Y) + eval("_root.codeMC:scrollPointUpper"));
  47.       }
  48.    }
  49.    else
  50.    {
  51.       if(collision == "on")
  52.       {
  53.          if(inRange == "off" or xCollision == "off")
  54.          {
  55.             set("_root.CodeMC:platformActive",eval("_root.CodeMC:platformActive") - 1);
  56.             collision = "off";
  57.          }
  58.       }
  59.       this;
  60.       if(hitTest(_root.playerMC) and eval("_root.codeMC:jumping") == "on" and getProperty("_root.playerMC", _X) > _X + getProperty("_root.BackgroundMC", _X) and getProperty("_root.PlayerMC", _X) < _X + _width + getProperty("_root.BackgroundMC", _X) and getProperty("_root.playerMC", _Y) > _Y + getProperty("_root.backgroundMC", _Y) + _height)
  61.       {
  62.          setProperty("_root.playerMC", _Y, _Y + getProperty("_root.backgroundMC", _Y) + getProperty("_root.playerMC", _height) + _height);
  63.          set("_root.codeMC:jumping","off");
  64.          set("_root.codeMC:jumpSpeed",0);
  65.          set("_root.codeMC:fallSpeed",0);
  66.       }
  67.       if(getProperty("_root.playerMC", _Y) > _Y + getProperty("_root.BackgroundMC", _Y) and getProperty("_root.playerMC", _Y) < _Y + getProperty("_root.BackgroundMC", _Y) + _height and getProperty("_root.playerMC", _X) > _X + getProperty("_root.backgroundMC", _X) and getProperty("_root.playerMC", _X) < _X + getProperty("_root.backgroundMC", _X) + _width)
  68.       {
  69.          if(eval("_root.CodeMC:direction") == 1)
  70.          {
  71.             setProperty("_root.playerMC", _X, _X + getProperty("_root.backgroundMC", _X) - 1);
  72.          }
  73.          if(eval("_root.CodeMC:direction") == -1)
  74.          {
  75.             setProperty("_root.playerMC", _X, _X + getProperty("_root.backgroundMC", _X) + _width + 1);
  76.          }
  77.          set("_root.CodeMC:state","Stopped");
  78.       }
  79.    }
  80. }
  81.