AddParticleToObject(1,"Highlight");
MoveEmiter("Highlight",460,465);
AddParticleToObject(101,"car");
MoveEmiter("car",841,354);
AddParticleToObject(105,"voda1");
MoveEmiter("voda1",404,235);
AddParticleToObject(104,"voda2");
MoveEmiter("voda2",663,235);
StartEmiter("voda2")
StartEmiter("voda1")
WaitRender();


if not  flags.kluch then
StartEmiter("car")
Set_Cursor(101,4);	
end


function gameinput(sender,obj_id,attachedID)
	if SLevel==1.0 then return; end;
--обработка плашки	
	 if (sender == 1  or sender==5) and not isTimes  and imagetex~=-1 then
			set_visible_object(obj.plashechka.id,false)
			set_visible_object(obj[imagetex].id,false)
			del_object_from_game(5654547)		
			gameinput(26,imageid)	
del_object_from_game(5654547)
				del_object_from_game(5654547)
				del_object_from_game(5654547)
				del_object_from_game(5654547)
				del_object_from_game(5654547)
				del_object_from_game(5654547)				
	end
	
	if sender == 2 then
		RemoveFromMouse(object);
		MessageProc(sender,obj_id);
	return;end;	
if sender==777 then
--старт уровня	
			if top_plush_id and  flags.comics1 then			
				
			StartTimer(43342,0.5,"conv9")
			function conv9()
				CreatePlashechka(9999,"51","goodgirl")	
			end						
				ShowMenu(true)
				SwitchToSheet("re")
				flags.comics1=false	
			return;end	
	if top_plush_id then		
		ShowMenu(true)
		end	
	
	end

	if sender==26 then
--после сообщения чсто пора в путь Машина поехала!!	
	if obj_id==75 and not flags.finish then
			MoveByVector(1005,1024,202,3,100)			
			StartAnimation(699);
			StartTravel(699,1,nil,nil,{"InstantiationOfLine",2,757,342,1024+118,202+66,3,false})
			playeffect("077")	
			del_object_from_game(obj.dragonfly.id)
			flags.finish=true
			StartTimer(245353,4,"endofcar")
			function endofcar()			
			leafobj={2234}
			GetRenderTarget(2234,"rendertar");	
			minigg=true;
			levelnext=10;
			end
		
		end
	
	end	
	
if sender ==41 then	
	RotateHandler(obj_id);
if obj_id ==obj.dragonfly.id then	
	StartAnimation( 5555555555,1,5 );
	return;end;	
	return;end;
--коллапс мусора	
	if sender == 12 then	
		if obj_id == obj.vel.id or obj_id == obj.otkr.id or obj_id == obj.ognet.id or obj_id == obj.siga.id or obj_id == obj.rog.id or
			obj_id == obj.noj.id or obj_id == obj.term.id or obj_id == obj.vilka.id or obj_id == obj.drot.id or obj_id == obj.klu4.id or obj_id == obj.kruk.id or
			obj_id == obj.jiga.id or obj_id == obj.perec.id or obj_id == obj.statua.id or obj_id == obj.stakan.id then
	    	
			if flags.items == 15 then
				flags.items_collected = true;				
					AlternateTimer("SwitchSheet1",1000)	
					if flags.kluch then						
						flags.comics2= true;
						StopEmiter("car")
						WaitRender()
					end
			end;
			end
		
		if obj_id == obj.klu4.id then
			StoreObj(obj_id );					
		end;
	return; end;
	
	if sender == 33 then
		
		if not flags.finish then
		flags.finish = false;
			ShowMenu(true);
			SwitchToSheet("re");
		return end
	return;end;
	

	if sender == 100 then
	

		if flags.finish then

		return; end;
		if flags.first_time_load then
				flags.first_time_load=false
				set_visible_object(obj.intro.id,true);
				speciale_action(4,obj.intro.id)			
				flags.start_draw = false;
		return; end;
		
		
		if flags.start_draw then
			flags.start_draw = false;		
		return; end;	
				-- First Comics --
	return; end;
		if sender == 8 then
		HideGlove();	
		takeobjecttohand=false
		HideScaner();
		HideRentgen()
		HideNvg();
	return end;
	
if sender == 1 then
--тыкаем на машину с ключем либо без	
		if obj_id == 101 and not flags.kluch then
				if scaner_on then
				CreatePlashechka(9999,"70","goodgirl")
			return;end;
			if attachedID== obj.klu41.id then
			 if flags.items_collected then
					RemoveFromMouse(obj.klu41.id);
					flags.kluch=true;
					 playeffect("076")
					UnStoreObj(obj.klu41.id)
					Set_Cursor(101,3)
					if flags.items_collected then
					flags.comics2= true;
					StopEmiter("car")
					set_visible_object(101,false)
					flags.comics2 = false;			
					add_animation(699);
					set_visible_object(1005,true)		
					CreatePlashechka(75,"53","goodgirl")						
					HideGlove()
					canmenu=true
					else
					CreatePlashechka(68,"58","goodgirl")
					end
				return; end;
				
				RemoveFromMouse(obj.klu4.id)
				CreatePlashechka(9999,"57","goodgirl")
			 return; end;
				CreatePlashechka(9999,"55","goodgirl")
			return; end;
--тыкаем на мусор	
	if obj_id == obj.vel.id or obj_id == obj.otkr.id or obj_id == obj.ognet.id or obj_id == obj.siga.id or obj_id == obj.rog.id or
			obj_id == obj.noj.id or obj_id == obj.term.id or obj_id == obj.vilka.id or obj_id == obj.drot.id or obj_id == obj.klu4.id or obj_id == obj.kruk.id or
			obj_id == obj.jiga.id or obj_id == obj.perec.id or obj_id == obj.statua.id or obj_id == obj.stakan.id then
				if attachedID~=-1 then return;end
				if scaner_on then
				CreatePlashechka(9999,"70","goodgirl")
			return;end;
			CollapseObj(obj_id);
			flags.items = flags.items + 1
			
			if flags.items == 15 then
				flags.items_collected = true	
				
			end
		return; end;
return; end;

	
	if sender == 14 then -- Menu click
		if not scaner_on then
			addObjectToMouse(obj_id)
		end
		-- takeobjecttohand=true;
	return; end;
return; end; 



function SelectRandom()
local dist=-1;local a=-1;local b=-1;local v=100;local t=-1;local diag=-1;
local width = -1;local height = -1;local radius=1.2;
				
	if flags.items >= 15 then
	computation(101);
		
	return end
	ok = false
	while not ok do
		help_id = GetRandomObject();
		for i,v in pairs(obj) do
			if v.id == help_id and not v.is_collapsed then
				ok = true
				x,y=GetObjectPosition(v.id);
				x1,y1=GetObjectPosition(obj.dragonfly.id);
				width,height = GetObjectSize(v.id)
				a= (x-x1); b= (y-y1);  dist= math.sqrt (a^2+b^2);				
		        t=dist/400;		
                r = (math.sqrt(width^2+height^2)*0.5);		
				
				if r<50 then	r=75;	radius=4;	end  -- при радиусе меньше 50 определяем время кружения и радиус стрекозы
				
				if r>50 and r <100 then	r=87 radius=2.5;  end  --при радиусе больше 50 и меньше 100
				
				if r>100 then 	r=100 	radius=0.75;  end  -- при радиусе больше 100
				
				StartBigTravel(obj.dragonfly.id, v.id, 0, t, r/90, t, 2 ,radius);
			return end
		end
	end
end;
