dofile("script\\gamemenu.lua");
dofile("script\\lib.lua");
set_inpun_fun("gameinput");
location={}
location["avariya"] = true
location["avariya"] = {}
location["avariya"]["id"] = 12
location["avariya"]["sub_id"] = 0
location["car"] = true
location["car"] = {}
location["car"]["id"] = 12
location["car"]["sub_id"] = 1
-- CreateConsole()
function LevelComplete()
  speciale_action(2,119)
  AddElement("gr",119);
  MoveObjectToTree(119);
  setcurentleaf("car",12,1);
  if not flags.flower then
    AddElement("gr",121);
    MoveObjectToTree(121);
    flags.flower=true;
    LevelComplete()
  return;end;  
  if not flags.key9 then
    flags.key9=true;
    LevelComplete();
  return;end;
  DeleteElement("gr",300);  
  DeleteElement("gr",213);  
  DeleteElement("gr",214);
  DeleteElement("gr",215);
  DeleteElement("gr",118);
  DeleteElement("gr",120);
  flags.levelcomplete=true;
    whole_darkness=false;
  DarkScreen(true);
  ShowMenu(false)
end;
function LoadingLevel(param)
if flags.levelcomplete then
  delete_tree_leaf("Root","car");-- Добавляет лист в дерево 
  delete_tree_leaf("Root","avariya");-- Добавляет лист в дерево 
  setnextlavel(13);
  loadlavel();
return; end;
SetAlfaValue(503,0);
     SLevel=param;
return;end;
function LoadNextLevel()
delete_tree_leaf("Root","car");-- Добавляет лист в дерево 
delete_tree_leaf("Root","avariya");-- Добавляет лист в дерево 
setnextlavel(13);
loadlavel();  
end;
flags={};
flags["comx"]=false;
flags["comx1"]=false;
flags["HintCount"]=5;
flags["minicomplete"]=false;
flags["minicomplete1"]=false;
flags["loc1"] = false;
flags["firstloc1"] = true;
flags["loc2"] = false;
flags["mouse"] = false;
flags["transmission"]=false;
flags["keys"]=true;
flags["trunk"]=false;
flags["all"]=false;
flags["last"]=false;
flags["mousein"] = false;
flags["flower"] = false;
flags["key9"] = false;
flags["neitralka"] = false;
flags["levelcomplete"]= false;
flags["nohints"]=false;
flags["miw"]=false;
flags["crea"]=false;
add_tree_leaf("Root","car",12,1);
  addstaticobjecttogame(877777777,"buttons",114,625,"",60,0,61,61);
  SetCurrentRM("menu");
  AddSheet(1002,"re","red_b",103,656,37,41,"",99,657,650,80,92,21,5,5,0,59,877777777,nil,"buttonsY");
  SetCurrentRM("main");
  loadresource("data\\photoaparat.png","photoaparat",2000029);
loadresource("data\\animationMENU3.png","menuAn",2000030);
AddImgToBook("photoaparat",821,637);
AddHints()
dofile("./data/12/1/res.lua");
 UpdateStack();
add_tree_leaf("Root","avariya",12,0);
  addstaticobjecttogame(877777777,"buttons",114,625,"",60,0,61,61);
  SetCurrentRM("menu");
  AddSheet(1002,"re","red_b",103,656,37,41,"",99,657,670,80,92,21,5,5,0,59,877777777,nil,"buttonsY");
  SetCurrentRM("main");

dofile("./data/12/0/res.lua");
 UpdateStack();
setcurentleaf("avariya",12,0);
WaitRender()
flags.comx= true

    ShowMenu(false);
    playfile(".\\sound\\game_theme2.ogg",true,true);
function StartLevel()
  DarkScreen(false);
  SetCurrentRM("menu");
    AddImgToBook("photoaparat",821,637);
    AddHints()
  SetCurrentRM("main");
  ShowMenu(true);
setcurentleaf("avariya",12,0);
  AddParticleToObject(68,"bawe",134,561);
  MoveEmiter("bawe",134,561);
    AddParticleToObject(67,"miwka",28,575);
  MoveEmiter("miwka",28,575);
    AddParticleToObject(70,"bagaj",649,248);
  MoveEmiter("bagaj",649,248);
  if flags.miw then
  set_visible_object(67,false)
  end
  if not flags.minicomplete34 then
    StartEmiter("bawe");
  end;
  if not flags.trunk then
    StartEmiter("bagaj");
  end;
  if not flags.mouse then  
    StartEmiter("miwka");
  end;
  if flags.trunk then
set_visible_object(70,false)
end
setcurentleaf("car",12,1);
if flags.crea then
set_visible_object(42,true)
end
    AddParticleToObject(39,"barda4",810,483);
    MoveEmiter("barda4",810,483);
    if (not flags.minicomplete5) then
      StartEmiter("barda4");
    end;
      AddParticleToObject(41,"pereda4a",523,623);
      MoveEmiter("pereda4a",523,623);
      if not flags.transmission then
        StartEmiter("pereda4a");
      end;  
      AddParticleToObject(42,"klu4i",286,374);
      MoveEmiter("klu4i",286,374);
      if  not flags.keys and not flags.transmission then
        StartEmiter("klu4i");
      end;
end