----------------------------------------------------------------
gamepause=false;
ingamemenu=false;
--------------------------------------------------------------
screan_loading_begin();
--loadresource("font.ttf","font",22);
loadresource("data\\1\\bg.jpg","bg",5);
loadresource("data\\1\\menu.png","menu",6);
loadresource("data\\1\\1.png","gazon",7);
loadresource("data\\1\\2.png","metla",8);
loadresource("data\\1\\3.png","lampa",9);
loadresource("data\\1\\4.png","yrna",10);
loadresource("data\\1\\5.png","lopata",11);
loadresource("data\\1\\6.png","vili",12);
loadresource("data\\1\\7.png","bak_blue",13);
loadresource("data\\1\\8.png","pec_chasi",14);
loadresource("data\\1\\9.png","fotik",15);
loadresource("data\\1\\10.png","futbol",16);
loadresource("data\\1\\11.png","sumka_black",17);
loadresource("data\\1\\12.png","shlapa",18);
loadresource("data\\1\\13.png","instryment_red",19);
loadresource("data\\1\\14.png","mouse",20);
loadresource("data\\1\\15.png","sad_nojn",21);
loadresource("data\\1\\16.png","trambon",22);
loadresource("data\\1\\17.png","books",23);
loadresource("data\\1\\18.png","lemon",24);
loadresource("data\\1\\19.png","zont",25);
loadresource("data\\1\\20.png","karandash",26);
loadresource("data\\1\\21.png","perchatki_green",27);
loadresource("data\\1\\22.png","gazeta",28);
loadresource("data\\1\\23.png","sova",29);
loadresource("data\\1\\24.png","korobok",30);
loadresource("data\\1\\25.png","butilka",31);
loadresource("data\\1\\26.png","lapti",32);
loadresource("data\\1\\27.png","shipchik",33);
loadresource("data\\1\\28.png","kozh_beg",34);
loadresource("data\\1\\29.png","ruchka",35);
loadresource("data\\1\\30.png","konki",36);
loadresource("data\\1\\31.png","ptichka",37);
loadresource("data\\1\\32.png","kolokol",38);
loadresource("data\\1\\33.png","venik",39);
loadresource("data\\1\\34.png","kegl",40);
loadresource("data\\1\\35.png","banana",41);
loadresource("data\\1\\36.png","cilinder",42);
loadresource("data\\1\\37.png","sinsila",43);
loadresource("data\\1\\38.png","butilka4",44);
loadresource("data\\1\\39.png","butilka3",45);
loadresource("data\\1\\40.png","butilka2",46);
loadresource("data\\1\\41.png","zonttrost",47);
loadresource("data\\1\\42.png","redkepka",48);
loadresource("data\\1\\43.png","apple",49);
loadresource("data\\1\\44.png","shell",50);
loadresource("data\\1\\45.png","basketbol",51);
loadresource("data\\1\\46.png","golftbol",52);
loadresource("data\\1\\47.png","kabel",53);
loadresource("data\\1\\48.png","lizard",54);
loadresource("data\\1\\49.png","baterfly",55);
loadresource("data\\1\\50.png","knife",56);
loadresource("data\\1\\51.png","diplomat",57);
loadresource("data\\1\\52.png","zamok",58);
loadresource("data\\1\\53.png","fonar",59);
loadresource("data\\1\\54.png","bumerang",60);
loadresource("data\\1\\55.png","skvor",61);
loadresource("data\\1\\56.png","kamera",62);
loadresource("data\\1\\57.png","skizor",63);
loadresource("data\\1\\58.png","lupa",64);
loadresource("data\\1\\59.png","kurka",65);
loadresource("data\\1\\60.png","metr",66);
loadresource("data\\1\\61.png","number",67);
loadresource("data\\1\\1\\banan.png","banan1",68);
loadresource("data\\1\\1\\kepka.png","kepka1",69);
loadresource("data\\1\\1\\konki.png","konki1",70);
loadresource("data\\1\\1\\lemon.png","lemon1",71);
loadresource("data\\1\\1\\tapki.png","tapki1",72);
loadresource("data\\1\\1\\ship.png","ship1",73);
loadresource("data\\1\\1\\karandash.png","karandash1",74);
loadresource("data\\1\\1\\zamok.png","zamok1",75);
loadresource("data\\1\\1\\provod.png","provod1",76);
loadresource("data\\1\\min_arrow.png","min_arrow",86);
loadresource("data\\1\\pause.png","pause",87);
loadresource("data\\1\\pausetext.png","pausetext",88);
loadresource("data\\1\\f.png","fader",89);
loadresource("data\\ingamebg.png","ingamebg",90);
loadresource("data\\1\\resum.png","resum",91);
loadresource("data\\1\\map.png","map",92);
loadresource("data\\1\\help.png","help",93);
loadresource("data\\1\\options.png","options",94);
loadresource("data\\1\\tomain.png","tomain",95);
loadresource("data\\1\\62.png","tomini",96);

--
addactivobjecttogame( -10,"resum",273,175,"","",0,0);--игровое меню
addactivobjecttogame( -9,"map",333,240,"","",0,0);--игровое меню
addactivobjecttogame( -8,"help",316,304,"","",0,0);--игровое меню
addactivobjecttogame( -7,"options",297,362,"","",0,0);--игровое меню
addactivobjecttogame( -6,"tomain",272,419,"","",0,0);--игровое меню

addstaticobjecttogame( -5,"ingamebg",198,29,"","",0,0);
addstaticobjecttogame( -4,"pausetext",89,217,"","",0,0);
addfade(-3);
addstaticobjecttogame( -2,"min_arrow",71,555,"");
addactivobjecttogame( -1,"pause",5,490,"","",0,0);
addstaticobjecttogame( 1,"menu",0,432,"");
addstaticobjecttogame( 2,"number",452,227,"цифра");
addstaticobjecttogame( 3,"metr",98,178,"метр");
addstaticobjecttogame( 4,"kurka",50,381,"курица");
addstaticobjecttogame( 5,"lupa",193,466,"лупа");
addstaticobjecttogame( 6,"skizor",301,351,"ножницы");
addstaticobjecttogame( 7,"kamera",0,249,"камера");
addstaticobjecttogame( 8,"skvor",92,64,"скворешник");
addstaticobjecttogame( 9,"bumerang",311,99,"бумеранг");
addstaticobjecttogame(10,"fonar",10,114,"фонарь");
 addactivobjecttogame(11,"zamok",16,422,"замок","zamok1",475,576);
addstaticobjecttogame(12,"diplomat",0,360,"дипломат");
addstaticobjecttogame(13,"knife",253,379,"нож");
addstaticobjecttogame(14,"baterfly",207,279,"бабочка");
addstaticobjecttogame(15,"lizard",167,274,"ящерица");
 addactivobjecttogame(16,"kabel",113,-2,"кабель","provod1",382,550);
addstaticobjecttogame(17,"basketbol",358,485,"баскетбольный мяч");
addstaticobjecttogame(18,"shell",155,466,"раковина");
addstaticobjecttogame(19,"apple",225,312,"яблоко");
 addactivobjecttogame(20,"redkepka",57,154,"красная кепка","kepka1",237,550);
addstaticobjecttogame(21,"zonttrost",89,174,"зонт трость");
addstaticobjecttogame(22,"butilka2",413,460,"бутылка2");
addstaticobjecttogame(23,"butilka3",137,386,"бутылка3");
addstaticobjecttogame(24,"butilka4",444,452,"бутылка4");
addstaticobjecttogame(25,"sinsila",270,307,"шиншила");
addstaticobjecttogame(26,"cilinder",261,341,"цилиндер");
addactivobjecttogame(27,"banana",355,237,"бананы","banan1",179,550);
addstaticobjecttogame(28,"kegl",431,443,"кегля");
addstaticobjecttogame(29,"venik",549,431,"веник");
addstaticobjecttogame(30,"kolokol",502,146,"колокол");
addstaticobjecttogame(31,"ptichka",511,12,"птичка");
 addactivobjecttogame(32,"konki",75,371,"коньки","konki1",298,550);
addstaticobjecttogame(33,"ruchka",535,452,"ручка");
addstaticobjecttogame(34,"kozh_beg",500,435,"кожанная сумка");
 addactivobjecttogame(35,"shipchik",382,316,"щипчик","ship1",268,576);
 addactivobjecttogame(36,"lapti",717,15,"лапти","tapki1",179,576);
addstaticobjecttogame(37,"butilka",381,362,"бутылка");
addstaticobjecttogame(38,"korobok",600,451,"коробок");
addstaticobjecttogame(39,"sova",221,123,"gazeta");
addstaticobjecttogame(40,"gazeta",89,467,"газета");
addstaticobjecttogame(41,"perchatki_green",157,173,"перчатки зеленые");
 addactivobjecttogame(42,"karandash",486,525,"карандаш","karandash1",377,576);
addstaticobjecttogame(43,"zont",309,402,"зонт");
 addactivobjecttogame(44,"lemon",295,476,"лемон","lemon1",469,550);
addstaticobjecttogame(45,"books",203,436,"книги");
addstaticobjecttogame(46,"trambon",458,369,"трамбон");
addstaticobjecttogame(47,"sad_nojn",278,407,"садовые ножницы");
addstaticobjecttogame(48,"mouse",266,461,"мышь");
addstaticobjecttogame(50,"instryment_red",132,412,"инструмент");
addstaticobjecttogame(51,"shlapa",595,220,"шляпа");
addstaticobjecttogame(52,"sumka_black",295,398,"сумка");
addstaticobjecttogame(53,"futbol",301,400,"футбольный мяч");
addstaticobjecttogame(54,"fotik",595,390,"Лопата");
addstaticobjecttogame(55,"pec_chasi",582,368,"Песочные часы");
addstaticobjecttogame(56,"bak_blue",254,363,"Лампа");
addstaticobjecttogame(57,"vili",231,262,"вилы");
addstaticobjecttogame(58,"lopata",228,257,"Лопата");
addstaticobjecttogame(59,"yrna",575,417,"Урна");
addstaticobjecttogame(60,"lampa",59,159,"Лампа");
addstaticobjecttogame(61,"metla",549,254,"Метла");
addstaticobjecttogame(62,"gazon",142,303,"Газонокосилка");
addactivobjecttogame(109,"tomini",740,282,"","",0,0);
setminigameobject(109);
addstaticobjecttogame(63,"bg",0,0,"bg");



--
set_inpun_fun("gameinput");
speciale_action(0,-2,180);
speciale_action(1,-1);--устанавливаем проверку на наведении мыши
speciale_action(2,-3);--скрываем обьект
speciale_action(2,-4);--скрываем обьект
speciale_action(2,-5);--скрываем обьект

speciale_action(2,-6);--скрываем обьект
speciale_action(2,-7);--скрываем обьект
speciale_action(2,-8);--скрываем обьект
speciale_action(2,-9);--скрываем обьект
speciale_action(2,-10);--скрываем обьект
speciale_action(1,-6);--реакция на наведение
speciale_action(1,-7);--реакция на наведение
speciale_action(1,-8);--реакция на наведение
speciale_action(1,-9);--реакция на наведение
speciale_action(1,-10);--реакция на наведение

loadprofile();
screan_loading_end();
function loadmini ()--Загружает мини игру
	switch_objects_obj();

	--loadresource("font.ttf","font",50);
	loadresource("data\\1\\mini\\m1_val.png","m1_val",80);
	loadresource("data\\1\\mini\\m1_numbers.png","m1_numbers",79);
	loadresource("data\\1\\mini\\m1_bg.png","m1_bg",78);
	loadresource("data\\1\\mini\\m1_bdown.png","m1_bdown",77);
	loadresource("data\\1\\mini\\m1_bup.png","m1_bup",81);
	loadresource("data\\1\\mini\\m1_indicator.png","m1_indicator",82);
	loadresource("data\\1\\mini\\m1_checkbutton.png","m1_checkbutton",83);
	loadresource("data\\1\\mini\\exit.png","m1_exit",84);
	loadresource("data\\1\\mini\\reset.png","m1_reset",85);
	
	loadresource("data\\1\\mini\\one.png","1",97);
	loadresource("data\\1\\mini\\two.png","2",98);
	loadresource("data\\1\\mini\\three.png","3",99);
	loadresource("data\\1\\mini\\four.png","4",100);
	loadresource("data\\1\\mini\\five.png","5",101);
	
	addtexttogame(108,300,435,"5");
	
	
	
	--addactivobjecttogame(110,"m1_exit",637,533,"","",0,0);
	
	addactivobjecttogame(107,"m1_exit",637,533,"","",0,0);
	addactivobjecttogame(108,"m1_checkbutton",437,413,"","",0,0);--сборос
	addactivobjecttogame(74,"m1_checkbutton",265,413,"","",0,0);--проверка
	
	
	addstaticobjecttogame(64,"m1_indicator",76 ,269,"");
	set_obj_size(64,50,50);
	addstaticobjecttogame(65,"m1_indicator",142,269,"");
	set_obj_size(65,50,50);
	addstaticobjecttogame(66,"m1_indicator",206,269,"");
	set_obj_size(66,50,50);
	addstaticobjecttogame(67,"m1_indicator",273,269,"");
	set_obj_size(67,50,50);
	addstaticobjecttogame(68,"m1_indicator",335,269,"");
	set_obj_size(68,50,50);
	addstaticobjecttogame(69,"m1_indicator",401,269,"");
	set_obj_size(69,50,50);
	addstaticobjecttogame(70,"m1_indicator",469,269,"");
	set_obj_size(70,50,50);
	addstaticobjecttogame(71,"m1_indicator",532,269,"");
	set_obj_size(71,50,50);
	addstaticobjecttogame(72,"m1_indicator",596,269,"");
	set_obj_size(72,50,50);
	addstaticobjecttogame(73,"m1_indicator",663,269,"");
	set_obj_size(73,50,50); 
	                                   
	



	addactivobjecttogame(75,"m1_bdown",76 ,336,"","",0,0);
	addactivobjecttogame(76,"m1_bdown",142,336,"","",0,0);
	addactivobjecttogame(77,"m1_bdown",206,336,"","",0,0);
	addactivobjecttogame(78,"m1_bdown",273,336,"","",0,0);
	addactivobjecttogame(79,"m1_bdown",335,336,"","",0,0);
	addactivobjecttogame(80,"m1_bdown",401,336,"","",0,0);
	addactivobjecttogame(81,"m1_bdown",469,336,"","",0,0);
	addactivobjecttogame(82,"m1_bdown",532,336,"","",0,0);
	addactivobjecttogame(83,"m1_bdown",596,336,"","",0,0);
	addactivobjecttogame(84,"m1_bdown",663,336,"","",0,0);

	addactivobjecttogame(85,"m1_bup",76 ,72,"","",0,0);
	addactivobjecttogame(86,"m1_bup",142,72,"","",0,0);
	addactivobjecttogame(87,"m1_bup",206,72,"","",0,0);
	addactivobjecttogame(88,"m1_bup",273,72,"","",0,0);
	addactivobjecttogame(89,"m1_bup",335,72,"","",0,0);
	addactivobjecttogame(90,"m1_bup",401,72,"","",0,0);
	addactivobjecttogame(91,"m1_bup",469,72,"","",0,0);
	addactivobjecttogame(92,"m1_bup",532,72,"","",0,0);
	addactivobjecttogame(93,"m1_bup",596,72,"","",0,0);
	addactivobjecttogame(94,"m1_bup",663,72,"","",0,0);



	addstaticobjecttogame(95,"m1_bg",0,0,"");
	addstaticobjecttogame(96,"m1_numbers",76 ,151,"");
	set_obj_size(96,61,61);
	addstaticobjecttogame(97,"m1_numbers",142,151,"");
	set_obj_size(97,61,61);
	addstaticobjecttogame(98,"m1_numbers",206,151,"");
	set_obj_size(98,61,61);
	addstaticobjecttogame(99,"m1_numbers",273,151,"");
	set_obj_size(99,61,61);
	addstaticobjecttogame(100,"m1_numbers",335,151,"");
	set_obj_size(100,61,61);
	addstaticobjecttogame(101,"m1_numbers",401,151,"");
	set_obj_size(101,61,61);
	addstaticobjecttogame(102,"m1_numbers",469,151,"");
	set_obj_size(102,61,61);
	addstaticobjecttogame(103,"m1_numbers",532,151,"");
	set_obj_size(103,61,61);
	addstaticobjecttogame(104,"m1_numbers",596,151,"");
	set_obj_size(104,61,61);
	addstaticobjecttogame(105,"m1_numbers",663,151,"");

	addstaticobjecttogame(106,"m1_val",78,151,"");
	
	init_mini(1);
	create_mini();
end--loadmini()

function gameinput (sender,obj_id)
	
	if sender == 1--обрабатываем ввод от мышки
	then
-------------------------------------------------------------------------------------------------------
		if obj_id == 11 
		then
		 --move_to_vault_obj(obj_id,0,0,10,1);
		 collaps_obj(obj_id,0,0,10,1);
		
		elseif obj_id == 27 
		then
		 collaps_obj(obj_id,0,0,10,1);
		elseif obj_id == 44 
		then
		 collaps_obj(obj_id,0,0,10,1);		 
		elseif obj_id == 109--загружаем мини игру 
		then
		loadmini();
		elseif obj_id == 16 
		then
		 collaps_obj(obj_id,0,0,10,1);		
		elseif obj_id == 20 
		then
		 collaps_obj(obj_id,0,0,10,1);
		elseif obj_id == 27 
		then
		 collaps_obj(obj_id,0,0,10,1);
		elseif obj_id == 32 
		then
		 collaps_obj(obj_id,0,0,10,1);
		elseif obj_id == 35 
		then
		 collaps_obj(obj_id,0,0,10,1);
		elseif obj_id == 36 
		then
		 collaps_obj(obj_id,0,0,10,1);
		elseif obj_id == 42 
		then
		 collaps_obj(obj_id,0,0,10,1);


		 
------------------------------------------------------------------------------------------------------------------------
		--//кнопка 1
		elseif obj_id == 75 
		then
			move_texture(96,1);
		elseif  obj_id == 85
		then
			move_texture(96,0);
			
		--//кнопка 2
		elseif obj_id == 76 
		then
			move_texture(97,1);
		elseif  obj_id == 86
		then
			move_texture(97,0);
			
		--//кнопка 3
		elseif obj_id == 77 
		then
			move_texture(98,1);
		elseif  obj_id == 87
		then
			move_texture(98,0);		
		--//кнопка 4
		elseif obj_id == 78 
		then
			move_texture(99,1);
		elseif  obj_id == 88
		then
			move_texture(99,0);	
		--//кнопка 5
		elseif obj_id == 79 
		then
			move_texture(100,1);
		elseif  obj_id == 89
		then
			move_texture(100,0);	
		--//кнопка 6
		elseif obj_id == 80 
		then
			move_texture(101,1);
		elseif  obj_id == 90
		then
			move_texture(101,0);
		--//кнопка 6
		elseif obj_id == 81 
		then
			move_texture(102,1);
		elseif  obj_id == 91
		then
			move_texture(102,0);
		--//кнопка 7
		elseif obj_id == 82 
		then
			move_texture(103,1);
		elseif  obj_id == 92
		then
			move_texture(103,0);
		--//кнопка 8
		elseif obj_id == 83 
		then
			move_texture(104,1);
		elseif  obj_id == 93
		then
			move_texture(104,0);
		--//кнопка 9
		elseif obj_id == 84 
		then
			move_texture(105,1);
		elseif  obj_id == 94
		then
			move_texture(105,0);

		elseif obj_id == 74 
		then
		 check_mini_game();
		 
		elseif obj_id == 107 
		then
			switch_objects_obj();	 
		elseif obj_id == 108 
		then
			reset_game();
			
		elseif obj_id == -1 --кликаем на паузу
		then
			if ingamemenu == false
			then
				gamepause=true;	
				pause();
				speciale_action(2,-4);		
				speciale_action(2,-3);
			end			
		elseif obj_id == -3 --кликаем на черный экран
		then
			if ingamemenu == false
			then
				gamepause=false;	
				pause();
				speciale_action(2,-4);		
				speciale_action(2,-3);
			end	
		elseif obj_id == -10
		then
			ingamemenu= not ingamemenu;					
			pause();
			speciale_action(2,-3);
			speciale_action(2,-5);
			speciale_action(2,-6);--скрываем обьект
			speciale_action(2,-7);--скрываем обьект
			speciale_action(2,-8);--скрываем обьект
			speciale_action(2,-9);--скрываем обьект
			speciale_action(2,-10);--скрываем обьект
		
		elseif obj_id == -6
		then
		savegame();
		setstatemenu();		

		end
-------------------------------------------------------------------------------------------------------	
	elseif sender == 2 --обрабатываем ввод с клавиатуры
	then
-------------------------------------------------------------------------------------------------------	
		if obj_id == 1--нажали эскейп 
			then
				if gamepause==false
				then
					ingamemenu= not ingamemenu;				
					pause();
					speciale_action(2,-3);
					speciale_action(2,-5);
					speciale_action(2,-6);--скрываем обьект
					speciale_action(2,-7);--скрываем обьект
					speciale_action(2,-8);--скрываем обьект
					speciale_action(2,-9);--скрываем обьект
					speciale_action(2,-10);--скрываем обьект
				else
					gamepause=false;	
					pause();
					speciale_action(2,-4);		
					speciale_action(2,-3);				
					--speciale_action(2,-6);--скрываем обьект
					--speciale_action(2,-7);--скрываем обьект
					--speciale_action(2,-8);--скрываем обьект
					--speciale_action(2,-9);--скрываем обьект
					--speciale_action(2,-10);--скрываем обьект
				
				end;
			end			
-------------------------------------------------------------------------------------------------------
	elseif sender == 3 --обрабатываем ввод с клавиатуры
	then
-------------------------------------------------------------------------------------------------------	
	speciale_action(2,-3);--скрываем обьект	
	print("Time is Up");
-------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------
	elseif sender == 4 --на сцене отработали все объекты
	then
	speciale_action(2,-3);--скрываем обьект
	endlavel();
-------------------------------------------------------------------------------------------------------



	end
	
	
	

end
--
--
--
--
--
--
--
--
--
--
--
--
--
