function InitCommon()
	SetToolCount(2,-1);
	SetToolCount(3,-1);
	SetToolCount(4,-1);
	SetToolCount(5,-1);
	SetToolCount(6,-1);
	SetToolCount(7,-1);
	SetToolCount(8,-1);
	SetToolCount(9,-2);
	BlockTile(7,4,true);
	BlockTile(11,3,true);
end

function OnInit()
	InitCommon();
	RequiresStop(0,true);
	AddTile("door0",8,7,4,1);
	AddTile("door1",8,11,3,1);
	AddAnimation("slideDown0",0,0,0,0,-0.8,0,3,false);
	AddAnimation("slideDown1",0,0,0,0,-0.8,0,3,false);
end

function OnReset()
	InitCommon();
end

function OnTrigger(trigger,robot)
	if (trigger==0) then
		EndGame(true);
	end

	if (trigger==1) then
		AnimateTile("door0","slideDown0");
	end

	if (trigger==2) then
		AnimateTile("door1","slideDown1");
	end
end

function OnAnimationDone(x,y)
	BlockTile(x,y,not IsBlocked(x,y));
end
