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

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