-----------------------------------------------------------------------------
-- Stage 3-7
-----------------------------------------------------------------------------
-- GLOBALS

G_MAX_SPEED = 1;

--Create a flock of birds. For now, this works best for a Flying V formation, following a path along the -x axis.
function CreateFlock(birdType, numBirds, path, yOffsetMin, yOffsetMax, flockType, speedFactor)
	local alt = 1;
	local offset = 0;
	if flockType == "V" then
		s = 2;
	else
		end   -- end if statement
	
	for i=0, numBirds-1, 1 do
		entGoose01=EntGame.SpawnBirdOnPath(birdType, path, 0, (s*offset), math.random(yOffsetMin, yOffsetMax), alt*(s*offset), speedFactor);
		Animal.FaceEntity(entGoose01, entCamera);
		alt = alt * (-1);
		if (i - math.floor(i/offset) * offset) == 0 then
			offset = offset + s;
		elseif  i == 0 then
			offset = offset + s;
		else
			end --end if statement
		end -- end for loop
	end;
	
--Create a group of animals Sharing the same path, with some time and path offset
function CreateGroup(animalType, numAnimals, path, spawnDelayMin, spawnDelayMax, speedFactor)
	for i=0, numAnimals, 1 do
		Script.WaitSec( math.random(spawnDelayMin, spawnDelayMax) );
		if speedFactor == "random" then
			entAnimal01=EntGame.SpawnAnimalOnPath(	animalType, path, 0, ST_WPT_RUN, 0, 
												math.random(-1.5, 1.5), 
												math.random(-1.5,1.5), 
												math.random(0.5,1.0) );
		else
			entAnimal01=EntGame.SpawnAnimalOnPath(  animalType, path, 0, ST_WPT_RUN, 0,
												math.random(-1.5, 1.5),
												math.random(-1.5, 1.5),
												speedFactor );
		end; --end if statement
		
		Animal.FaceEntity(entAnimal01, entCamera);
		end; --end for loop
	end;
	
-----------------------------------------------------------------------------    

function PostStage()

    EntGame.EnablePlayerControl(false);
    EntGame.ClearFlag(GF_READYTOSTART);
    EntGame.BindCameraToEntity("IntroCamera");
 
    end;    
    
-----------------------------------------------------------------------------    
-- Setup

function Setup()
    -- turn on the "Game running" menu - may not be needed for this game
    EntGame.PushMenu("MenuGameRunning");

    -- load world
    SetupWorld("Maps\\WorldJustinLand\\JustinLandCommon.ini", "Maps\\Stage3-7\\Stage3-7.ini","","");
    EntGame.CreatePlayerEntities();
	
    EntGame.SetGlobalDustColorInitial(1.0, 0.81, .75, .55);
    EntGame.SetGlobalDustColorFinal  (0.0, 0.81, .75, .55);

    EntGame.SetStageTimer(195);

    EntGame.LoadAnimal(AID_HARE_M);	
	EntGame.LoadAnimal(AID_SPURWINGGOOSE_M);
	EntGame.LoadAnimal(AID_LEOPARD_M);	
	EntGame.LoadAnimal(AID_WILDEBEEST_M);
	EntGame.LoadAnimal(AID_NILECROC_M);
		
    entHare01=EntGame.SpawnAnimalOnPath( AID_HARE_M, "IntroPath01", 0, ST_GRAZING, 20000, 0, 0, G_MAX_SPEED );
	entHare02=EntGame.SpawnAnimalOnPath( AID_HARE_M, "IntroPath01", 0, ST_GRAZING, 20000, 1.0, 1.0, G_MAX_SPEED );
	entHare03=EntGame.SpawnAnimalOnPath( AID_HARE_M, "IntroPath02", 0, ST_GRAZING, 20000, 0, 0, G_MAX_SPEED );
	entHare04=EntGame.SpawnAnimalOnPath( AID_HARE_M, "IntroPath03", 0, ST_GRAZING, 20000, 1.0, 1.0, G_MAX_SPEED );
	entHare05=EntGame.SpawnAnimalOnPath( AID_HARE_M, "IntroPath03", 0, ST_GRAZING, 20000, 0, 0, G_MAX_SPEED );
	entHare06=EntGame.SpawnAnimalOnPath( AID_HARE_M, "IntroPath02", 0, ST_GRAZING, 20000, 1.0, 1.0, G_MAX_SPEED );

	StartupSequence("Music\\Sahara Sunrise.ogg");
	EntGame.DestroyAllAnimals();
 
 --S   
 --[[ S
    Animal.SetState(entHare01, ST_GONE);
    Animal.SetState(entHare02, ST_GONE);
    Animal.SetState(entHare03, ST_GONE);
    Animal.SetState(entHare04, ST_GONE);
    Animal.SetState(entHare05, ST_GONE);
    Animal.SetState(entHare06, ST_GONE);
 S ]]--  
    end;

-----------------------------------------------------------------------------
function Part1()

	Camera.JumpToWaypoint(entCamera, "CamWptAA");
	Camera.SetSpeed(entCamera, 0.0, 0.1);
	
	entAfricanHare01=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 			--animalId	
												"Path1", 				--pathName
												0, 						--startWaypoint
												ST_WPT_RUN, 			--initialState
												0,						--aiTimer
												0, 						--xOffset
												0, 						--zOffset
												G_MAX_SPEED );		--speedFactor
	Animal.FaceEntity(entAfricanHare01, entCamera);
	
	Script.WaitSec(2);
	entAfricanHare02=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path2", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare02, entCamera);
	
	Script.WaitSec(1);
	entAfricanHare03=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path2", 
												0, 
												ST_WPT_RUN, 
												0, 
												1, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare03, entCamera);
	
	entAfricanHare04=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path3", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare04, entCamera);
	
	entAfricanHare05=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path4", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare05, entCamera);
	
	Script.WaitSec(1);
	entAfricanHare06=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path7", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare06, entCamera);
	
	Script.WaitSec(1);
	entAfricanHare14=EntGame.SpawnAnimalOnPath( AID_HARE_M,
												"LongPath4",
												0,
												ST_WPT_RUN,
												0,
												0,
												0,
												G_MAX_SPEED * 0.8 );
	Animal.FaceEntity(entAfricanHare14, entCamera);
	
	entAfricanHare15=EntGame.SpawnAnimalOnPath( AID_HARE_M,
												"LongPath5",
												0,
												ST_WPT_RUN,
												0,
												0,
												0,
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare15, entCamera);
	
	Script.WaitSec(3); -- SHOOT TIME
	--System.ConsoleBeep(440, 100);
	
    end;    
-----------------------------------------------------------------------------
function Part2()

--for debug
--Camera.JumpToWaypoint(entCamera, "CamWptAA");

	Camera.SetSpeed(entCamera, 2.0, 0.1); 
	Camera.StopAtWaypoint(entCamera, "CamWptBB");
	Camera.StopAtWaypoint(entCamera, "CamWptCC");
	
	Script.WaitSec(2);
	entAfricanHare07=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path6", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare07, entCamera);
	
	CreateGroup( AID_HARE_M, 4, "Path2", 1.0, 1.5, G_MAX_SPEED);
	
	Script.WaitSec(3);
	EntGame.SpawnAnimalOnPath( AID_HARE_M, "Path4", 0, ST_WPT_RUN, 0, 0, 0, G_MAX_SPEED );
	EntGame.SpawnAnimalOnPath( AID_HARE_M, "Path4", 0, ST_WPT_RUN, 0, 1.0, 1.0, 0.7 * G_MAX_SPEED );
	
	
	
	Script.WaitSec(1);
	entAfricanHare11=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path11", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare11, entCamera);	
	
	Script.WaitSec(2);
	entAfricanHare12=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path12", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0,
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare12, entCamera);
	
	Script.WaitSec(3);
	entAfricanHare13=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path12", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare13, entCamera);		
	
	Script.WaitSec(5);
	entAfricanHare14=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path11", 
												0, 
												ST_WPT_RUN, 
												0,
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare14, entCamera);	
	
	Script.WaitSec(2);
	entAfricanHare15=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path12", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare15, entCamera);
	
	Script.WaitSec(3);
	
	--Camera.SetFov(entCamera, 40, .5);
	
	Camera.SetTiltOffset(entCamera, -15, 0.5);
	entAfricanHare15=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path0", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare15, entCamera);
	
	Script.WaitSec(1);
	entAfricanHare15=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path0", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare15, entCamera);
	
	Script.WaitSec(1);
	entAfricanHare15=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path00", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare15, entCamera);
	
	Script.WaitSec(2);
	entAfricanHare16=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path13", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare16, entCamera);		
	
	entAfricanHare15=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path00", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare15, entCamera);
	
	Script.WaitSec(2);
	entAfricanHare08=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path8", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare08, entCamera);
	
	Script.WaitSec(1);
	entAfricanHare09=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path9", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare09, entCamera);
	
	Script.WaitSec(2);
	entAfricanHare10=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path10", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare10, entCamera);
	
	Script.WaitSec(2);
	entAfricanHare11=EntGame.SpawnAnimalOnPath( AID_HARE_M,
												"LongerPath1",
												0,
												ST_WPT_WALK,
												0,
												0,
												0,
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare11, entCamera);
	
	entAfricanHare15=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path00", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare15, entCamera);
	
	Script.WaitSec(1);
	entAfricanHare15=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path0", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare15, entCamera);
	
	Script.WaitSec(1);
	
	entAfricanHare15=EntGame.SpawnAnimalOnPath(	AID_HARE_M, 
												"Path0", 
												0, 
												ST_WPT_RUN, 
												0, 
												0, 
												0, 
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare15, entCamera);
	
	entAfricanHare12=EntGame.SpawnAnimalOnPath( AID_HARE_M,
												"Path10",
												0,
												ST_WPT_RUN,
												0,
												0,
												0,
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare12, entCamera);
	
	Script.WaitSec(1);
	entAfricanHare12=EntGame.SpawnAnimalOnPath( AID_HARE_M,
												"Path8",
												0,
												ST_WPT_RUN,
												0,
												0,
												0,
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare12, entCamera);
	
	Script.WaitSec(1);
	entAfricanHare12=EntGame.SpawnAnimalOnPath( AID_HARE_M,
												"Path8",
												0,
												ST_WPT_RUN,
												0,
												0,
												0,
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare12, entCamera);
	
	Script.WaitSec(1);
	entAfricanHare12=EntGame.SpawnAnimalOnPath( AID_HARE_M,
												"Path9",
												0,
												ST_WPT_RUN,
												0,
												0,
												0,
												G_MAX_SPEED );
	Animal.FaceEntity(entAfricanHare12, entCamera);
	
	Script.WaitSec(1);
	end;
---------------------------------------------------------------------------------------------------------------------
function Part3()

	--This line for debug purposes
	--Camera.JumpToWaypoint(entCamera, "CamWptCC");
	--Camera.SetSpeed(entCamera, 0.0, 0.1);
	
	--Sequence: Two Leopards chasing a heard of Wildebeest off in the distance.
	Script.WaitSec(1);
	Camera.SetPanOffset(entCamera, 130, 1.5);
	Camera.SetTiltOffset(entCamera, 0, 0.5);
	
	--Camera.SetFov(entCamera, 60, 0.5);
	
	Script.WaitSec(0.5);
	entWildebeest01=EntGame.SpawnAnimalOnPath(	AID_WILDEBEEST_M, 
												"Path20", 
												0, 
												ST_WPT_RUN, 
												0, 
												math.random(0,1), 
												math.random(0,1), 
												G_MAX_SPEED );
	Animal.FaceEntity(entWildebeest01, entCamera);
	
	Script.WaitSec(0.25);
	entWildebeest02=EntGame.SpawnAnimalOnPath(	AID_WILDEBEEST_M, 
												"Path20", 
												0, 
												ST_WPT_RUN, 
												0, 
												math.random(0,1), 
												math.random(0,1), 
												G_MAX_SPEED );
	Animal.FaceEntity(entWildebeest02, entCamera);
	
	Script.WaitSec(0.5);
	entWildebeest03=EntGame.SpawnAnimalOnPath(	AID_WILDEBEEST_M, 
												"Path20", 
												0, 
												ST_WPT_RUN, 
												0, 
												math.random(0,1), 
												math.random(0,1), 
												G_MAX_SPEED );
	Animal.FaceEntity(entWildebeest03, entCamera);
	
	Script.WaitSec(0.5);
	entLeopard01=EntGame.SpawnAnimalOnPath(	AID_LEOPARD_M, 
											"Path20", 
											0, 
											ST_WPT_RUN, 
											0, 
											math.random(0,1), 
											math.random(0,1), 
											0.6 * G_MAX_SPEED );
	Animal.FaceEntity(entLeopard01, entCamera);
	
	Script.WaitSec(0.5);
	entLeopard02=EntGame.SpawnAnimalOnPath(	AID_LEOPARD_M, 
											"Path20", 
											0, 
											ST_WPT_RUN, 
											0, 
											math.random(0,1), 
											math.random(0,1), 
											0.6 * G_MAX_SPEED );
	Animal.FaceEntity(entLeopard02, entCamera);
	
	Script.WaitSec(0.5);
	entWildebeest04=EntGame.SpawnAnimalOnPath(	AID_WILDEBEEST_M, 
												"Path21", 
												0, 
												ST_WPT_RUN, 
												0, 
												math.random(0,1), 
												math.random(0,1), 
												G_MAX_SPEED );
	Animal.FaceEntity(entWildebeest04, entCamera);
	
	Script.WaitSec(0.25);
	entWildebeest05=EntGame.SpawnAnimalOnPath(	AID_WILDEBEEST_M, 
												"Path21", 
												0, 
												ST_WPT_RUN, 
												0, 
												math.random(0,1), 
												math.random(0,1), 
												G_MAX_SPEED );
	Animal.FaceEntity(entWildebeest05, entCamera);
	entAfricanHare01=EntGame.SpawnAnimalOnPath(	AID_HARE_M,
												"LongPath1",
												0, ST_WPT_RUN, 0, 0, 0, 1);
	Animal.FaceEntity(entAfricanHare01, entCamera);
	
	Script.WaitSec(0.5);
	entWildebeest06=EntGame.SpawnAnimalOnPath(	AID_WILDEBEEST_M, 
												"Path21", 
												0, 
												ST_WPT_RUN, 
												0, 
												math.random(0,1), 
												math.random(0,1), 
												G_MAX_SPEED );
	Animal.FaceEntity(entWildebeest06, entCamera);
	
	entAfricanHare02=EntGame.SpawnAnimalOnPath( AID_HARE_M,
												"LongPath2",
												0, ST_WPT_RUN, 0, 0, 0, 1);
	Animal.FaceEntity(entAfricanHare02, entCamera);
	
	Script.WaitSec(0.25);
	entWildebeest07=EntGame.SpawnAnimalOnPath(	AID_WILDEBEEST_M, 
												"Path21", 
												0, 
												ST_WPT_RUN, 
												0, 
												math.random(0,1), 
												math.random(0,1), 
												G_MAX_SPEED );
	Animal.FaceEntity(entWildebeest07, entCamera);
	
	entAfricanHare03=EntGame.SpawnAnimalOnPath(	AID_HARE_M,
												"LongPath3",
												0, ST_WPT_WALK, 0, 0, 0, 1);
	Animal.FaceEntity(entAfricanHare03, entCamera);
	
	entAfricanHare04=EntGame.SpawnAnimalOnPath( AID_HARE_M,
												"LongerPath4",
												0, ST_WPT_RUN, 0, 0, 0, G_MAX_SPEED );
    Animal.FaceEntity(entAfricanHare04, entCamera);
	
	Script.WaitSec(4);
	CreateFlock( AID_SPURWINGGOOSE_M, 5, "Path21", 7.0, 9.0, "V", G_MAX_SPEED );
												
	Script.WaitSec(6);
	--End sequence
	

	end;
-----------------------------------------------------------------------------
function Part4()

	--Move Camera through next set of waypoints.
	--Camera.JumpToWaypoint(entCamera, "CamWptCC");
	
	Camera.SetPanOffset(entCamera, -170, 1.5);
	Camera.SetPanOffset(entCamera, 0, 1.5);
	Camera.SetSpeed(entCamera, 2.0, 0.1); 
	Camera.StopAtWaypoint(entCamera, "CamWptEE");
	
	Script.WaitSec(2);
	CreateGroup( AID_HARE_M, 3, "Path19", 1.0, 1.5, G_MAX_SPEED );
	
	Script.WaitSec(8);
	CreateFlock(AID_SPURWINGGOOSE_M, 11, "Path22", -1.0, 1.0, "V", 0.8 * G_MAX_SPEED);	
	Script.WaitSec(6);
	CreateFlock(AID_SPURWINGGOOSE_M, 15, "Path23", -1.0, 1.0, "V", 0.7 * G_MAX_SPEED);
	Script.WaitSec(5);
	
	
	end;
-----------------------------------------------------------------------------
function Part5()
	
	--For debug
	--Camera.JumpToWaypoint(entCamera, "CamWptEE");
	--Camera.SetSpeed(entCamera, 0.0, 0.1);
		
	entCroc01=EntGame.SpawnAnimalOnPath( AID_NILECROC_M, "Path24", 0, ST_WPT_RUN, 0, 0, 0, G_MAX_SPEED );
	Animal.FaceEntity(entCroc01, entCamera);
	Animal.SetAutoChargeDist(entCroc01, 20.0);
	Animal.SetAttackType(entCroc01, ATK_STATIC);
	Animal.SetAttackRepeat(entCroc01, 2);
	Animal.SetPostAttackRand(entCroc01, false);
	Animal.SetPostAttackDir(entCroc01, 90);	
	Entity.SetName(entCroc01, "entCroc01");
	
	Script.WaitSec(1);
	
	entCroc02=EntGame.SpawnAnimalOnPath( AID_NILECROC_M, "Path25", 0, ST_WPT_RUN, 0, 0, -2, G_MAX_SPEED );
	Animal.FaceEntity(entCroc02, entCamera);
	Animal.SetAutoChargeDist(entCroc02, 20.0);
	Animal.SetAttackType(entCroc02, ATK_STATIC);
	Animal.SetAttackRepeat(entCroc02, 2);
	Animal.SetPostAttackRand(entCroc02, false);
	Animal.SetPostAttackDir(entCroc02, -90);	
	Entity.SetName(entCroc02, "entCroc02");
	
	Script.WaitSec(1.5);
	
	Camera.SetPanOffset(entCamera, -5, 0.5);
	Camera.SetTiltOffset(entCamera, -25, 0.5);
	
	Script.WaitSec(1.5);
	
	entCroc03=EntGame.SpawnAnimalOnPath( AID_NILECROC_M, "Path26", 0, ST_WPT_RUN, 0, 0, 0, G_MAX_SPEED );
	Animal.FaceEntity(entCroc03, entCamera);
	Animal.SetAutoChargeDist(entCroc03, 20.0);
	Animal.SetAttackType(entCroc03, ATK_STATIC);
	Animal.SetAttackRepeat(entCroc03, 2);
	Animal.SetPostAttackRand(entCroc03, false);
	Animal.SetPostAttackDir(entCroc03, 90);	
	Entity.SetName(entCroc03, "entCroc03");

	Script.WaitSec(2);

	Camera.SetPanOffset(entCamera, 15, 0.5);
	Camera.SetTiltOffset(entCamera, -20, 0.5);

	Script.WaitSec(3);

	Camera.SetPanOffset(entCamera, -25, 0.5);
	Camera.SetTiltOffset(entCamera, -20, 0.5);
	
	Script.WaitSec(5);
			
	end;
	
-----------------------------------------------------------------------------
function Part6()

	EntGame.DestroyAllAnimals()
	Camera.SetTiltOffset(entCamera, 0, 1.0);
	Camera.SetSpeed(entCamera, 2.0, 0.1); 
	Camera.SetPanOffset(entCamera, 0, 1.0);
	Camera.StopAtWaypoint(entCamera, "CamWptFF");
	Script.WaitSec(3);
	entCroc01=EntGame.SpawnAnimalOnPath(AID_NILECROC_M, "Path31", 0, ST_WPT_RUN, 0, 0 ,0, G_MAX_SPEED );
	Animal.FaceEntity(entCroc01, entCamera);
	Script.WaitSec(9);
	CreateGroup( AID_HARE_M, 2, "Path40", 1.0, 1.5, G_MAX_SPEED );
	Script.WaitSec(3);
	CreateGroup( AID_HARE_M, 2, "Path41", 1.0, 1.5, G_MAX_SPEED );
	Script.WaitSec(4);
	CreateGroup( AID_HARE_M, 4, "Path42", 1.0, 1.5, G_MAX_SPEED );
	CreateGroup( AID_HARE_M, 3, "Path32", 1.0, 1.5, G_MAX_SPEED );
	entHare01=EntGame.SpawnAnimalOnPath(AID_HARE_M, "Path37", 0, ST_WPT_RUN, 0, 0 ,0, G_MAX_SPEED );
	Animal.FaceEntity(entHare01, entCamera);
	Script.WaitSec(1);
	CreateGroup( AID_HARE_M, 3, "Path43", 1.0, 1.5, G_MAX_SPEED );
	Script.WaitSec(1);
	CreateGroup( AID_HARE_M, 2, "Path44", 1.0, 1.5, G_MAX_SPEED );
	end;
	
-----------------------------------------------------------------------------
function Part7()

	CreateGroup( AID_HARE_M, 2, "Path33", 1.0, 1.5, G_MAX_SPEED );
	entHare01=EntGame.SpawnAnimalOnPath(AID_HARE_M, "Path37", 0, ST_WPT_RUN, 0, 0 ,0, G_MAX_SPEED );
	Animal.FaceEntity(entHare01, entCamera);
	CreateGroup( AID_HARE_M, 2, "Path34", 1.0, 1.5, G_MAX_SPEED );
	entHare01=EntGame.SpawnAnimalOnPath(AID_HARE_M, "Path38", 0, ST_WPT_RUN, 0, 0 ,0, G_MAX_SPEED );
	Animal.FaceEntity(entHare01, entCamera);
	CreateFlock(AID_SPURWINGGOOSE_M, 11, "LongerPath6", -1.0, 1.0, "V", 0.8 * G_MAX_SPEED);
	Script.WaitSec(1);
	CreateGroup( AID_HARE_M, 3, "Path35", 1.0, 1.5, G_MAX_SPEED );
	CreateGroup( AID_HARE_M, 2, "Path18", 1.0, 1.5, G_MAX_SPEED );	
	entHare01=EntGame.SpawnAnimalOnPath(AID_HARE_M, "Path39", 0, ST_WPT_RUN, 0, 0 ,0, G_MAX_SPEED );
	Animal.FaceEntity(entHare01, entCamera);
	Script.WaitSec(1);
	CreateGroup( AID_HARE_M, 2, "Path36", 1.0, 1.5, G_MAX_SPEED );
	entHare01=EntGame.SpawnAnimalOnPath(AID_HARE_M, "Path32", 0, ST_WPT_RUN, 0, 0 ,0, G_MAX_SPEED );
	Animal.FaceEntity(entHare01, entCamera);
	Script.WaitSec(2);
	CreateGroup( AID_HARE_M, 2, "Path37", 1.0, 1.5, G_MAX_SPEED );
	entHare01=EntGame.SpawnAnimalOnPath(AID_HARE_M, "Path33", 0, ST_WPT_RUN, 0, 0 ,0, G_MAX_SPEED );
	Animal.FaceEntity(entHare01, entCamera);
	Script.WaitSec(1);
	CreateGroup( AID_HARE_M, 3, "Path38", 1.0, 1.5, G_MAX_SPEED );
	entHare01=EntGame.SpawnAnimalOnPath(AID_HARE_M, "Path34", 0, ST_WPT_RUN, 0, 0 ,0, G_MAX_SPEED );
	Animal.FaceEntity(entHare01, entCamera);
	Script.WaitSec(2);
	CreateGroup( AID_HARE_M, 3, "Path39", 1.0, 1.5, G_MAX_SPEED );
	entHare01=EntGame.SpawnAnimalOnPath(AID_HARE_M, "Path35", 0, ST_WPT_RUN, 0, 0 ,0, G_MAX_SPEED );
	Animal.FaceEntity(entHare01, entCamera);
	CreateGroup( AID_HARE_M, 3, "Path32", 1.0, 1.5, G_MAX_SPEED );
	entHare01=EntGame.SpawnAnimalOnPath(AID_HARE_M, "Path36", 0, ST_WPT_RUN, 0, 0 ,0, G_MAX_SPEED );
	Animal.FaceEntity(entHare01, entCamera);

	end;
-----------------------------------------------------------------------------
-- Main entry point
   
Setup();   
Part1(); 
Part2();  
Part3();
Part4();
Part5(); 
Part6();
Part7();
