canmenu=true
mojemnavodit=false
------Emitters-------------------
AddParticleToObject(201,"fakel1");
MoveEmiter("fakel1",70,455);

AddParticleToObject(202,"fakel2");
MoveEmiter("fakel2",980,300);
------End Emitters------------

local fram14 = false;
local frame = 0;
Bad_He = 1006;
Bad_She = 1005;
He = 1004;
She = 1003;
x,y = 0;
k = 1;
flag = false;
aa = 0;
bb = 0;
set_visible_object(CurrM,false)
function frame1()
	StartTimer(1200,5);
	speciale_action(2,1);
	speciale_action(4,1101);
	speciale_action(2,1101,true);
	speciale_action(4,top_plush_id);
	speciale_action(4,bottom_plush_id);
	speciale_action(4,skip_id);
	SemiClosePlushes();
	StartEmiter("fakel1");
	StartEmiter("fakel2");
	frame = 1;	
	set_visible_object(CurrM,false)
	playeffect("123")	
return;end;

function frame2()
	StopEffect("123")
	del_object_from_game(1101)
	speciale_action(4,1102);
	speciale_action(2,1101);
	speciale_action(2,1102,true);
	speciale_action(4,top_plush_id);
	speciale_action(4,bottom_plush_id);
	speciale_action(4,skip_id);
	frame = 2;
return;end;

function frame3()

	del_object_from_game(1102)
	speciale_action(4,1103);
	speciale_action(2,1102);
	
	speciale_action(2,1103,true);
	speciale_action(4,top_plush_id);
	speciale_action(4,bottom_plush_id);
	speciale_action(4,skip_id);
	frame = 3;
return;end;

function frame4()

	speciale_action(4,1106);
	speciale_action(2,1103);
	del_object_from_game(1103)
	speciale_action(2,1106,true);
	speciale_action(4,top_plush_id);
	speciale_action(4,bottom_plush_id);
	speciale_action(4,skip_id);
	frame = 4;
return;end;

function frame5()
del_object_from_game(1106)

	speciale_action(4,2);
	speciale_action(2,2,true);
	x,y = GetObjectPosition(2);
	ScaleObject(2,1,1.2,4,512,384);
	speciale_action(4,top_plush_id);
	speciale_action(4,bottom_plush_id);
	speciale_action(4,CurrM);
	set_text(CurrM, "103");
	speciale_action(4,skip_id);
	playeffect("124")
	frame = 5;
return;end;

function frame6()


	speciale_action(4,3);
	speciale_action(2,3,true);
	x,y = GetObjectPosition(2);
	ScaleObject(3,1,1.2,5,512,384);
	MoveObjectX(2,x,x+100,5);
	speciale_action(4,top_plush_id);
	speciale_action(4,bottom_plush_id);
	speciale_action(4,skip_id);
	frame = 6;
return;end;

function frame7()
		StopEffect("124")
		leafobj={2235}
		GetRenderTarget(2235,"rendertar1");	
		
		function rendertar1(tex_name,tex_id)
			FlipVertical(2235);
			SetAlfa(2235,0,1,0,"vasea3353523")
			SetObjectPosition(2235,0,-256);
			LeaveObjectsOnReder("leafobj");
				
			addstaticobjecttogame(4, "4",0,0,"");
			set_visible_object(4,false)
			speciale_action(4,4);
			speciale_action(2,4,true);
			addstaticobjecttogame(1010, "b",169,217,"");
			set_visible_object(1010,false)
			speciale_action(4,1010);
			speciale_action(2,1010,true);
			x,y = GetObjectPosition(2);
			addstaticobjecttogame(top_plush_id, "plush", 0, -256, "");
			addstaticobjecttogame(bottom_plush_id, "plush", 0, 640, "");		
			addactivobjecttogame(skip_id,"skip",860,45,"","");
			speciale_action(4,top_plush_id);
			speciale_action(4,bottom_plush_id);
			speciale_action(4,skip_id);		
			frame = 7;
		end
		

return;end;

function frame8()

	del_object_from_game(3)
	del_object_from_game(2)
	speciale_action(4,He);
	speciale_action(4,Bad_She);	

	MoveObjectY(top_plush_id, -256, -384, 1.2/2);
	MoveObjectY(bottom_plush_id, 640, 769,1.2/2);
	HideSkipButton()
	StartTimer(777,1)

	speciale_action(4,top_plush_id);
	speciale_action(4,bottom_plush_id);
	speciale_action(4,skip_id);
	frame = 8;
return;end;

function frame9()
	frame = 9;

return;end;

function frame10()
	frame = 10;

return;end;

function frame11()

	speciale_action(2,1012);
	frame = 11;
return;end;

function frame12()

	-- speciale_action(2,1011);
	speciale_action(4,She);
	frame = 12;
return;end;
function frame13()
	frame = 13;

return;end;

function frame14()
if not fram14 then
	fram14=true
	BlockCursor(true)
	addstaticobjecttogame(5, "5",0,0,"");
	set_visible_object(5,false)
	speciale_action(4,5);
	speciale_action(2,5,true);	
	playeffect("125")
	StartTimer(2323232,2,"starthomeak")
	function starthomeak()
	frame = 15;
	BlockCursor(false)
	end
	
end
return;end;

frame1();
function gameinput (sender,obj_id,attachedID)

	if (sender == 1 or sender == 6) 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)			
	end
	
	if sender==26 then
		if obj_id ==50 then

		CreatePlashechka(51,"105","goodman")	
		BlockCursor(true)
		end
		if obj_id ==51 then
	
		addstaticobjecttogame(1011, "a",36,139,"");
		set_visible_object(1011,false)
		speciale_action(2,1010,true)
		speciale_action(4,1011);
		speciale_action(2,1011,true)
		CreatePlashechka(52,"106","goodgirl")	
		BlockCursor(true)
		
		end
		if obj_id ==52 then
		del_object_from_game(1010)

	
		CreatePlashechka(53,"107","goodman")	
		BlockCursor(true)
		
		end
		
		if obj_id ==53 then
		frame14();		
		del_object_from_game(1010)
		del_object_from_game(1011)
		StartTimer(335252,1.5,"del")
		function del()
		del_object_from_game(4)
		end	
		
		end
	
	end
	
	if sender==35 then	
		if obj_id==765 then
			set_visible_object(766,true)
		end
		
	end
	
	
	if sender==39 then
		if obj_id==766 then
			set_visible_object(766,false)
		end
	end
	
	if sender==777 then
			loadresource("data\\images\\developers1.png","developers1");
			loadresource("data\\images\\developers2.png","developers2");			
			loadresource("data\\images\\farmills.png","farmills");
			loadresource("data\\menu\\exit_menu.png","exit_menu");
			addstaticobjecttogame(98775443,"farmills",322,175,"");
			set_visible_object(98775443,false)
			addstaticobjecttogame(765, "exit_menu",452,725,"",0,0,117,45);
			addstaticobjecttogame(766, "exit_menu",453,723,"",0,45,117,45);
			OnMouseOver(765)
			OnMouseOver(766)
			
			addstaticobjecttogame(5000,"developers",0,0,"");
			addstaticobjecttogame(98766, "developers1",0,0,"");
			addstaticobjecttogame(987657,"developers2",0,-600,"");
			set_visible_object(5000,false)
			set_visible_object(98766,false)
			set_visible_object(987657,false)
			set_visible_object(765,false)
			set_visible_object(766,false)
			speciale_action(4,5000);
			
			speciale_action(4,987657);
			speciale_action(4,98766);
			speciale_action(4,765);
			speciale_action(4,766);
			
			speciale_action(2,5000,true);	
			speciale_action(2,98766,true);
			speciale_action(2,987657,true);
			set_visible_object(765,true)			
			mojemnavodit=true
			playeffect("126")
			 BlockCursor(false)	
			 StartTravel(987657,1,nil,nil,{"InstantiationOfLine",2,0,600,0,-600,25,false},"konecigri")
			 
			 function konecigri()
			 speciale_action(4,98775443)
				speciale_action(2,98775443,true);
			 end
		--showdevelopers()
	end
	
	
	if sender == 33 then
		if plushes_were_closed then		
			
		else
			DrawSkipButton();
		end;
	return; end;	
	
	 
	if sender == 1 then
	
	
	
		if obj_id==skip_id then
			ClosePlushes()
			plushes_were_closed=true
			frame = 1000
		return; end;
	return; end;
	
	if sender == 28 then
		BlockCursor(false);
		if obj_id == Bad_She and frame == 8 then
			frame9();
		end;
		if obj_id == She and frame == 12 then
			frame13();
		end;
	return;end;
	
	if sender == 16 then
		if obj_id == 1106 then
			set_visible_object(CurrM,true)		
			setcolor(CurrM,1,1,1,1,1);
			
		end;
	return;end;
	
	if sender == 36 then
	if obj_id ==777 then
		CreatePlashechka(50,"104","badgirl")	
		BlockCursor(true)
	return;end
		if frame >= k and frame < 8 then
			if aa == 0 then
				StartTimer(1200,5);				
				k = k + 1;
				n = "frame"..(frame+1);
				assert(loadstring(n.."()"))()
			elseif aa > 0 then				
				aa = aa - 1;
			end;
		end;
	return;end;
	
	if sender == 29 then
		BlockCursor(false);
		if obj_id == 3 then			
			MoveObjectX(2,x,x+100,5);
		return;end;
		if obj_id == 2 then		
			StartTravel(2,1,nil,nil,{"InstantiationOfLine",2,x,y,x+100,y,4,false});
		return;end;		
	end;
	
	if sender == 6 then
	x,y=GetCursorPos();
	
	if x>458 and x<563 and y>729 and y<770 then
	setstatemenu();
	StopAllEffects()
	StopMusic()
	gamedata.curr_level=31
	SaveGame1()
	return;end;
	
		if frame >= k and frame < 8 then
			k = k + 1;
			n = "frame"..(frame+1);
			
			assert(loadstring(n.."()"))()
			aa = aa + 1;
			StartTimer(1200,5);
			flag = true;
		return;end;
	
		if frame == 15 then
			ClosePlushes();
			frame=6000;
		
		end;
	return; end;
end;