BirdCreator = function()
	if Birdcount == BirdMaxcount and BirdCreatorState then
		BirdCreatorState = false
		local Birds = Map.ActorsInBox(Map.TopLeft, Map.BottomRight, function(self) return self.Owner == clouds and (self.Type == "seagulls1" or self.Type == "seagulls2") end)
		Utils.Do(Birds, function(birds)
			birds.Teleport(CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)))
			birds.Stance = "HoldFire"
			birds.GrantUpgrade("nocontrol")
			birds.GrantUpgrade("autocontrol")
			birds.GrantUpgrade("wandering")
			Trigger.OnIdle(birds, function(bird)
				if not bird.IsDead and bird.IsInWorld then
					bird.Patrol({CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)), CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)), CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)), CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)), CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)), CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)), CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)), CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)), CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)), CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)), CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)), CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)), CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical))}, true, DateTime.Seconds(Utils.RandomInteger(11.22, 22.11)))
				end
			end)
		end)
	elseif Birdcount < BirdMaxcount and BirdCreatorState then
		CreateBird()
	end
end
-------------------------------------------------------------------
CreateBird = function()
	local Bird = Actor.Create("seagulls" .. Utils.RandomInteger(1, 2), true, { Owner = clouds, Location = CPos.New(Utils.RandomInteger(MapSlippedEdgeStartHorizontical, MapSlippedEdgeOverHorizontical), Utils.RandomInteger(MapSlippedEdgeStartVertical, MapSlippedEdgeOverVertical)) })
	Birdcount = Birdcount + 1
	Trigger.OnRemovedFromWorld(Bird, function()
		Birdcount = Birdcount - 1
		if Birdcount < BirdMaxcount and BirdCreatorState then BirdCreator() end
	end)
	if Birdcount < BirdMaxcount and BirdCreatorState then BirdCreator() end
end

