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

function OnInit()
	InitCommon();
	RequiresStop(0,true);
	AddTile("door",8,5,2,1);
	AddAnimation("slideDown",0,0,0,0,-0.8,0,3,false);
end

function OnReset()
	InitCommon();
end

function OnTrigger(trigger,robot)
	if (trigger==0) then
		EndGame(true);
	else if (trigger==1) then
		AnimateTile("door","slideDown");
		end
	end
end

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