dofile("script\\gamemenu.lua");
dofile("script\\lib.lua");
set_inpun_fun("gameinput");
location={}
location["garaj"] = true
location["garaj"] = {}
location["garaj"]["id"] =8
location["garaj"]["sub_id"] = 0

function LevelComplete()
  AddElement("gr",174);
  MoveObjectToTree(174);
  AddElement("gr",167);
  MoveObjectToTree(167);
  AddElement("gr",115);
  MoveObjectToTree(115);
  DeleteElement("gr",1);
  DeleteElement("gr",9);
  DeleteElement("gr",10);
  DeleteElement("gr",100);
  DeleteElement("gr",111);
  DeleteElement("gr",112);
  DeleteElement("gr",113);
  DeleteElement("gr",114);
  DeleteElement("gr",172);
  DeleteElement("gr",126);
  DeleteElement("gr",127);
  DeleteElement("gr",101);
  DeleteElement("gr",202);
  DeleteElement("gr",212);
  DeleteElement("gr",206);
  DeleteElement("gr",301);
  DeleteElement("gr",309);
  flags.levelcomplete=true;
    whole_darkness=false;
  DarkScreen(true);
  ShowMenu(false)
end;

frame=0;

flags={};

flags["loc1"] = false;
flags["loc2"] = false;
flags["loc3"] = false;
flags["firstloc2"]=true;
flags["firstloc3"]=true;
flags["zapic"]=true;
flags["comx"]=false;
flags["comx1"]=false;
flags["minicomplete"]=false;
flags["minicomplete1"]=false;
flags["minicomplete2"]=false;
flags["minicomplete3"]=false;
flags["minicomplete4"]=false;
flags["minicomplete5"]=false;
flags["minicomplete6"]=false;
flags["minicomplete7"]=false;
flags["HintCount"]=5;
flags["auto"]=false;
flags["wheel"]=false;
flags["bolt"]=false;
flags["door"]=false;
flags["enter"]=false;
flags["dog"]=false;
flags["oil"]=false;
flags["snake"]=false;
flags["case"]=false;
flags["address"]=false;
flags["card"]=false;
flags["keys"]=false;
flags["levelcomplete"]= false;
flags["nohints"]=false;
skip= false;
add_tree_leaf("Root","garaj",8,0);
  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");
ShowMenu(false);
loadresource("data\\photoaparat.png","photoaparat",2000029);
loadresource("data\\animationMENU3.png","menuAn",2000030);
AddImgToBook("photoaparat",821,637);
AddHints()
setcurentleaf("garaj",8,0);
SwitchToSheet("re");
dofile("./data/8/0/res.lua");
WaitRender()
flags.comx= true
playfile(".\\sound\\game_theme2.ogg",true,true);
function LoadingLevel(param)
if flags.levelcomplete then
  delete_tree_leaf("Root","garaj");-- Добавляет лист в дерево 
  setnextlavel(25);
  loadlavel();
return; end;
SetAlfaValue(503,0);
     SLevel=param;
return;end;
function StartLevel()
  AddParticleToObject(63,"Svet2",506,471);
  MoveEmiter("Svet2",506,471);
  AddParticleToObject(57,"koleco",541,461);
  MoveEmiter("koleco",541,461);
  AddParticleToObject(59,"mawina",590,583);
  MoveEmiter("mawina",723,515);
  AddParticleToObject(36,"korobka",977,594);
  MoveEmiter("korobka",977,594);
  if not flags.first then
    StartEmiter("korobka");
  end;
  if not flags.minicomplete24 and flags.minicomplete30 then
  StartEmiter("Svet2");
  end;
  if not flags.auto then  
  StartEmiter("koleco");
  end;
  if not flags.minicomplete30 then
  StartEmiter("mawina");
  end;
      if flags.minicomplete30 then 
    CreatePolygon(63,4,"Field")
    StartEmiter("Svet2");
    Set_Cursor(63,2);
    if not flags.minicomplete24 then
      set_visible_object(63,true)
    end;
  end
  DarkScreen(false);
    SetCurrentRM("menu");
    AddImgToBook("photoaparat",821,637);
    AddHints()
  SetCurrentRM("main");
    ShowMenu(true);
end