home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Diversos / clowns.swf / scripts / DefineSprite_369 / frame_1 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  965 b   |  50 lines

  1. function init()
  2. {
  3.    regClear();
  4.    setLevel(_global.opt.startLevel);
  5.    ready = true;
  6. }
  7. function regClear()
  8. {
  9.    regObjects = new Array();
  10.    regCount = 0;
  11. }
  12. function register(pObject)
  13. {
  14.    pObject.reset();
  15.    regObjects[regCount++] = pObject;
  16. }
  17. function resetLevel()
  18. {
  19.    i = 0;
  20.    while(i < regCount)
  21.    {
  22.       regObjects[i].reset();
  23.       i++;
  24.    }
  25. }
  26. function nextLevel()
  27. {
  28.    setLevel(_global.stat.actLevel + 1);
  29. }
  30. function setLevel(pLevel)
  31. {
  32.    if(_global.stat.actLevel == pLevel)
  33.    {
  34.       resetLevel();
  35.    }
  36.    else
  37.    {
  38.       _global.stat.actLevel = pLevel;
  39.       regClear();
  40.       matter.solid.gotoAndStop(_global.stat.actLevel);
  41.       matter.deadly.gotoAndStop(_global.stat.actLevel);
  42.       matter.ghost.gotoAndStop(_global.stat.actLevel);
  43.       fg.gotoAndStop(_global.stat.actLevel);
  44.       bg.gotoAndStop(_global.stat.actLevel);
  45.       markers.gotoAndStop(_global.stat.actLevel);
  46.    }
  47. }
  48. stop();
  49. init();
  50.