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

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