-----------------------------------------------------------------------------
-- Stage 5-2
-----------------------------------------------------------------------------

function PostStage()

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

    Sound.Release(smpCaveSqueek);
        
    end;    
    
-----------------------------------------------------------------------------    
function Setup()

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

    -- load world
    SetupWorld("Maps\\WorldForestRavine\\ForestRavineCommon.ini", "Maps\\Stage5-2\\Stage5-2.ini","","");
    EntGame.CreatePlayerEntities();

    EntGame.SetGlobalDustColorInitial(0.2, 0.61, .58, .45);
    EntGame.SetGlobalDustColorFinal  (0.0, 0.61, .58, .45);

    EntGame.SetStageTimer(240);

    -- load sounds
    smpCaveSqueek  = Sound.Load("Sound/Environment/Cave2.wav");
        
	EntGame.LoadAnimal(AID_SABLE_M);
	EntGame.LoadAnimal(AID_SABLE_F);
	EntGame.LoadAnimal(AID_GEMSBOK_M);
	EntGame.LoadAnimal(AID_GEMSBOK_F);
	EntGame.LoadAnimal(AID_LEOPARD_M);	
	EntGame.LoadAnimal(AID_MEERKAT_M);
	EntGame.LoadAnimal(AID_SPURWINGGOOSE_M);
	
 	StartupSequence("Music\\Call The.ogg");
    
    end;

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

	Camera.JumpToWaypoint(entCamera, "CamWptAA");
    Camera.SetSpeed(entCamera, 0.0, 0.1);
               
    a1=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "BunnyPath1", 0, ST_WPT_RUN, 0, 0, 0, 0.3);
    Animal.FaceEntity(a1, entCamera);
    Script.WaitSec(4);
    a2=EntGame.SpawnAnimalOnPath(AID_SABLE_F, "BunnyPath2", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(a2, entCamera);
    Script.WaitSec(1.5);
	animal1=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath1", 0, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal1, 1.3);
    Animal.SetCoinMode(animal1, CM_SPAWNREL); 
    Animal.FaceEntity(animal1, entCamera); 
    Script.WaitSec(1.5);    	
    a3=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "BunnyPath3", 0, ST_WPT_RUN, 0, 0, 0, 0.3);
    Animal.FaceEntity(a3, entCamera);
    Script.WaitSec(3);
    a4=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "Path1", 0, ST_WPT_RUN, 0, 0, 0, 0.3);
    Animal.FaceEntity(a4, entCamera);
    Script.WaitSec(1.0); 
    animal3=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath1", 2, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal3, 1.0); 
    Animal.SetCoinMode(animal3, CM_SPAWNREL);
    Animal.FaceEntity(animal3, entCamera); 	
    Script.WaitSec(2.0);
   	a5=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_F, "BunnyPath2", 0, ST_WPT_RUN, 0, 0, 0, 0.3); 
   	Animal.FaceEntity(a5, entCamera);	
    Script.WaitSec(3);
    a6=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "BunnyPath4", 0, ST_WPT_RUN, 0, 0, 0, 0.3);
    Animal.FaceEntity(a6, entCamera);	
    Script.WaitSec(1.0);
    animal2=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath1", 1, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal2, 1.3); 
    Animal.SetCoinMode(animal2, CM_SPAWNREL);
    Animal.FaceEntity(animal2, entCamera);    	
    Script.WaitSec(2.0);
    a7=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_F, "BunnyPath1", 0, ST_WPT_RUN, 0, 0, 0, 0.3);	
    Animal.FaceEntity(a7, entCamera);
    Script.WaitSec(3);
    animal1=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath1", 0, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal1, 1.3); 
    Animal.SetCoinMode(animal1, CM_SPAWNREL);
    Animal.FaceEntity(animal1, entCamera); 	
    a8=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "BunnyPath5", 0, ST_WPT_RUN, 0, 0, 0, 0.3);	
    Animal.FaceEntity(a8, entCamera);
    Script.WaitSec(2.5);
    a9=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "BunnyPath4", 0, ST_WPT_RUN, 0, 0, 0, 0.3);	
    Animal.FaceEntity(a9, entCamera);
    Script.WaitSec(1.5);
    a10=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "BunnyPath3", 0, ST_WPT_RUN, 0, 0, 0, 0.3);	
    Animal.FaceEntity(a10, entCamera);   
    Script.WaitSec(5);
    	
   	Camera.SetSpeed(entCamera, 2.0, 0.1);  
    Camera.StopAtWaypoint(entCamera, "CamWptGG");

    Script.WaitSec(1.5);
 	EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "BunnyPath4", 0, ST_WPT_RUN, 0, 0, 0, 2);
    animal2=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath1", 1, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal2, 1.3);
    Animal.SetCoinMode(animal2, CM_SPAWNREL); 
    Animal.FaceEntity(animal2, entCamera);    		
    Script.WaitSec(1.5);	
    b1a=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_F, "Path1", 0, ST_WPT_RUN, 0, 0, -.5, 0.5);
    Animal.FaceEntity(b1a, entCamera);
    Script.WaitSec(1.0); 	   
    b1b=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "Path1", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(b1b, entCamera); 
    Script.WaitSec(1.5);	
    b1c=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_F, "Path1", 0, ST_WPT_RUN, 0, 0, .5, 0.5);
    Animal.FaceEntity(b1c, entCamera); 	        	
    Script.WaitSec(1.0);
    b2a=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "Path2", 0, ST_WPT_RUN, 0, 0, -.5, 0.5);
    Animal.FaceEntity(b2a, entCamera);
    Script.WaitSec(1.0);
    b2b=EntGame.SpawnAnimalOnPath(AID_SABLE_F, "Path2", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(b2b, entCamera);
    Script.WaitSec(1.0);
    b2c=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "Path2", 0, ST_WPT_RUN, 0, 0, .5, 0.5);
    Animal.FaceEntity(b2c, entCamera);        
    Script.WaitSec(1.5);
    b3=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "Path3", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(b3, entCamera);
    Script.WaitSec(1.5);
    b3a=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "Path3", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(b3a, entCamera);	 
    animal4=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath1", 3, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal4, 1.0);
    Animal.SetCoinMode(animal4, CM_SPAWNREL); 
    Animal.FaceEntity(animal4, entCamera);       	   	
    b4=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath6", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(b4, entCamera);
    Animal.SetAutoChargeDist(b4, 15);	
	Animal.SetAttackType(b4, ATK_STRAFE);
	Animal.SetStrafeAttackDist(b4, 5);
    
    Script.WaitSec(1.5);
    	
    animal5=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath1", 4, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal5, .8);
    Animal.SetCoinMode(animal5, CM_SPAWNREL); 
    Animal.FaceEntity(animal5, entCamera);      	
    b5=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath7", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(b5, entCamera);
    Script.WaitSec(1.5);
    b6=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath8", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(b6, entCamera);
    Script.WaitSec(1.0);
        
    --TURN LEFT       
    Camera.SetPanOffset(entCamera, -40, 2.0);            
    Script.WaitSec(0.5);
        
    b7=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "Path5", 0, ST_WPT_RUN, 0, 0, 0, 0.6);
    Animal.FaceEntity(b7, entCamera); 
    Animal.SetAutoChargeDist(b7, 15);	
	Animal.SetAttackType(b7, ATK_STRAFE); 
	Animal.SetStrafeAttackDist(b7, 5);     
    Script.WaitSec(1.0);      
	b8=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath10", 0, ST_WPT_RUN, 0, 0, 0, 0.6);
    Animal.FaceEntity(b8, entCamera);
    Script.WaitSec(3.5);      
	b8=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath11", 0, ST_WPT_RUN, 0, 0, 0, 0.6);
    Animal.FaceEntity(b8, entCamera);   
    Script.WaitSec(1.5);  
      
	--TURN RIGHT      
	Camera.SetPanOffset(entCamera, 40, 2.0);      
                      
    b9=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "Path4", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(b9, entCamera);        
    Script.WaitSec(2.0);
	b9a=EntGame.SpawnAnimalOnPath(AID_SABLE_F, "Path4", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(b9a, entCamera);         
    b10=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath10", 0, ST_WPT_RUN, 0, 0, 0, 0.6);
    Animal.FaceEntity(b10, entCamera);    
	Script.WaitSec(2.0);
	b9a=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_F, "Path4", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(b9a, entCamera); 	        	           
    b11=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath10", 0, ST_WPT_RUN, 0, 0, -.5, 0.6);
    Animal.FaceEntity(b11, entCamera);
    Animal.SetAutoChargeDist(b11, 10);	
	Animal.SetAttackType(b11, ATK_STRAFE); 
	Animal.SetStrafeAttackDist(b11, 5);     
    Script.WaitSec(1.0);
     	
    --RETURN TO CENTER    
    Camera.SetPanOffset(entCamera, 0, 2.0); 
    Script.WaitSec(.5);     
	b13=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "Path4", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(b13, entCamera);     
    Script.WaitSec(1.5);	
	b12=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_F, "Path4", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(b12, entCamera); 
    Script.WaitSec(1.0);
	b14=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "Path4", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(b14, entCamera); 
    Script.WaitSec(3.0);    
 
    EntGame.ShowCaption(STR_LVL_5_2_A, 0, 2.5);
    Script.WaitSec(4.0);
    EntGame.ShowCaption(STR_LVL_5_2_B, 0, 2.5);
    Script.WaitSec(3.5);           	    	
                 	    		  
    end;    

-----------------------------------------------------------------------------

function Part2()

	--Camera.JumpToWaypoint(entCamera, "CamWptGG");
    --Camera.SetSpeed(entCamera, 0.0, 0.01);
    
	Camera.SetSpeed(entCamera, 2.5, 0.1); 
	Camera.StopAtWaypoint(entCamera, "CamWptII");
    Camera.SetTiltOffset(entCamera, -15, 1.5);
    Camera.SetRollOffset(entCamera, 5, 1.5);
    
    Script.WaitSec(2);
    a = EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path6", 0, 0, -.5, 0, .8);
    Animal.SetCoinOffset(a, 1.5);	
    Camera.SetRollOffset(entCamera, -5, 1.5);	
    Script.WaitSec(1);
    a = EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path7", 0, 0, 0, 0, .8);	
    Animal.SetCoinOffset(a, 1.5);
    Camera.SetTiltOffset(entCamera, 10, 2.0);
    Script.WaitSec(1);
    a = EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path8", 0, 0, 1, 0, .8);	
    Animal.SetCoinOffset(a, 1.5);
    Camera.SetRollOffset(entCamera, 6, 1.5);
    Script.WaitSec(1);
    a = EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path9", 0, 0, 0, 0, .8); 
    Animal.SetCoinOffset(a, 1.5);
    Script.WaitSec(1);
    a = EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path6", 0, 0, 0, 0, .8);	
    Animal.SetCoinOffset(a, 1.5);	
    Camera.SetRollOffset(entCamera, -7, 1.5);   
    Script.WaitSec(1);
    a = EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path7", 0, 0, 1, 0, .8); 
    Animal.SetCoinOffset(a, 1.5);
    Script.WaitSec(1);
    Camera.SetRollOffset(entCamera, 6, 1.5);
    Script.WaitSec(1);
    a = EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path8", 0, 0, .5, 0, .8); 
    Animal.SetCoinOffset(a, 1.5);
    Script.WaitSec(1);
    Camera.SetTiltOffset(entCamera, 10, 1.5);
    Camera.SetRollOffset(entCamera, 0, 1.5);    
    	
    a1=EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path6", 0, 0, -.5, 0, .8);	
    Animal.SetCoinOffset(a1, 1.5);
    Animal.FaceEntity(a1, entCamera);
    Camera.SetRollOffset(entCamera, -5, 1.5);	
    Script.WaitSec(1);
    b1=EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path7", 0, 0, .5, 0, .8);
    Animal.SetCoinOffset(b1, 1.5);
    Animal.FaceEntity(b1, entCamera);	
    Script.WaitSec(1);
    c1=EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path8", 0, 0, .5, 0, .8);
    Animal.SetCoinOffset(c1, 1.5);
    Animal.FaceEntity(c1, entCamera);	
    Camera.SetRollOffset(entCamera, 6, 1.5);
    Script.WaitSec(1);
    d1=EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path9", 0, 0, 0, 0, .8); 
    Animal.SetCoinOffset(d1, 1.5);
    Animal.FaceEntity(d1, entCamera);
    Script.WaitSec(1);
    e1=EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path6", 0, 0, 0, 0, .8);	
    Animal.SetCoinOffset(e1, 1.5);
    Animal.FaceEntity(e1, entCamera);	
    Camera.SetRollOffset(entCamera, 0, 1.5);   
    Script.WaitSec(1);
    f1=EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path9", 0, 0, 0, 0, .8); 
    Animal.SetCoinOffset(f1, 1.5);
    Animal.FaceEntity(f1, entCamera);
    
    Script.WaitSec(3); --SHOOT TIME
                 	    		  
    end;    

-----------------------------------------------------------------------------

function Part3()

	Camera.SetSpeed(entCamera, 2.5, 0.1); 
	Camera.StopAtWaypoint(entCamera, "CamWptNN");

    GEMSBOK1=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "Path10", 0, ST_WPT_WALK, 6, 0, 0, .3);
	Animal.EnableFear(GEMSBOK1, false);
	Animal.FaceEntity(GEMSBOK1, entCamera);
	Entity.SetName(GEMSBOK1, "GEMSBOK1");
    g1=EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path6", 0, 0, -.5, 0, .8);	
    Animal.SetCoinOffset(g1, 1.5);
    Animal.FaceEntity(g1, entCamera);
    Camera.SetRollOffset(entCamera, -5, 1.5);	
    Script.WaitSec(1);
    h1=EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path7", 0, 0, 0, 0, .8);
    Animal.SetCoinOffset(h1, 1.5);
    Animal.FaceEntity(h1, entCamera);	
    Script.WaitSec(1);
	
    i1=EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "Path8", 0, 0, 0, 0, .8);
    Animal.SetCoinOffset(i1, 1.5);
    Animal.FaceEntity(i1, entCamera);	
    Camera.SetRollOffset(entCamera, 6, 1.5);
    Script.WaitSec(2);
    Camera.SetTiltOffset(entCamera, 0, 2.0);
    Camera.SetRollOffset(entCamera, 0, 1.5);
    
    Run("GEMSBOK1");
    
 	Script.WaitSec(2);
    EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath12", 0, ST_WPT_RUN, 0, 0, 0, .6);
    Script.WaitSec(1.5);
    b11 = EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath12", 0, ST_WPT_RUN, 0, .5, 0, .5);
    Animal.SetAutoChargeDist(b11, 15);	
	Animal.SetAttackType(b11, ATK_STRAFE); 
	Animal.SetStrafeAttackDist(b11, 5);     
    Script.WaitSec(1.5);
    EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath12", 0, ST_WPT_RUN, 0, -.5, -.5, .4);   
    Script.WaitSec(1.5);
     	
    a1=EntGame.SpawnAnimalOnPath(AID_SABLE_F, "BunnyPath13", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(a1, entCamera);
    Script.WaitSec(1.0);
    a2=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "BunnyPath13", 0, ST_WPT_RUN, 0, 0, 0, 0.4);
    Animal.FaceEntity(a2, entCamera);
    Script.WaitSec(1.0);    	
    a3=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "BunnyPath13", 0, ST_WPT_RUN, 0, 0, 0, 0.3);
    Animal.FaceEntity(a3, entCamera);
    Script.WaitSec(1.0);
    a4=EntGame.SpawnAnimalOnPath(AID_SABLE_F, "BunnyPath13", 0, ST_WPT_RUN, 0, 0, 0, 0.3);
    Animal.FaceEntity(a4, entCamera);	
    Script.WaitSec(1.0);
   	a5=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "BunnyPath13", 0, ST_WPT_RUN, 0, 0, 0, 0.3); 
   	Animal.FaceEntity(a5, entCamera);
   	Script.WaitSec(4);
    EntGame.ShowCaption(STR_LVL_5_2_C, 0, 2.5);
   	Script.WaitSec(2);
   		
   	--DECELLERATION
   	Script.WaitSec(.25);
   	Camera.SetSpeed(entCamera, 2.0, 0.1);
   	Script.WaitSec(.25);
   	Camera.SetSpeed(entCamera, 1.5, 0.1);
   	Script.WaitSec(.25);
   	Camera.SetSpeed(entCamera, 1.0, 0.1);
   	Script.WaitSec(.25);
   	Camera.SetSpeed(entCamera, .5, 0.1);  		
   	Script.WaitSec(.25);
   	Camera.SetSpeed(entCamera, 0, 0.1);   	
    --STOPPED
   	
    a6=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "BunnyPath14", 0, ST_WPT_RUN, 0, 0, 0, 0.4);
    Animal.FaceEntity(a6, entCamera);	  	
    Script.WaitSec(1.0);
    a7=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_F, "BunnyPath14", 0, ST_WPT_RUN, 0, 0, 0, 0.3);	
    Animal.FaceEntity(a7, entCamera);
    Script.WaitSec(1.5);
    a8=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_F, "BunnyPath14", 0, ST_WPT_RUN, 0, 0, 0, 0.5);	
    Animal.FaceEntity(a8, entCamera);
    Script.WaitSec(1.0);
    a9=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "BunnyPath14", 0, ST_WPT_RUN, 0, 0, 0, 0.4);	
    Animal.FaceEntity(a9, entCamera);
    Script.WaitSec(2.0);
    a10=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath14", 0, ST_WPT_RUN, 0, 0, 0, 1.2);	
    Animal.FaceEntity(a10, entCamera);   
    Script.WaitSec(1.0);
    a11=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath14", 0, ST_WPT_RUN, 0, 0, 0, 1.2);	
    Animal.FaceEntity(a11, entCamera);     
    Script.WaitSec(1.0);
    a12=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath15", 0, ST_WPT_RUN, 0, 0, 0, 1.2);	
    Animal.FaceEntity(a12, entCamera);
    Animal.SetAutoChargeDist(a12, 15);	
	Animal.SetAttackType(a12, ATK_STRAFE); 
	Animal.SetStrafeAttackDist(a12, 5);      
    a13=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath14", 0, ST_WPT_RUN, 0, 0, 0, 1.2);	
    Animal.FaceEntity(a13, entCamera); 
    Script.WaitSec(4.0);
     	
   	--ACCELLERATION
   	Script.WaitSec(.25);
   	Camera.SetSpeed(entCamera, .5, 0.1);
   	Script.WaitSec(.25);
   	Camera.SetSpeed(entCamera, 1.0, 0.1);
   	Script.WaitSec(.25);
   	Camera.SetSpeed(entCamera, 1.5, 0.1);
   	Script.WaitSec(.25);
   	Camera.SetSpeed(entCamera, 2.0, 0.1);  		
   	Script.WaitSec(.25);
   	Camera.SetSpeed(entCamera, 2.5, 0.1);   	
    --MOVING     	
     	
    a14=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath15", 0, ST_WPT_RUN, 0, 0, 0, 1.2);	
    Animal.FaceEntity(a14, entCamera); 
    Animal.SetAutoChargeDist(a14, 15);	
	Animal.SetAttackType(a14, ATK_STRAFE); 
	Animal.SetStrafeAttackDist(a14, 5);      
    Script.WaitSec(7.0);
    	  	      	
    EntGame.ShowCaption(STR_LVL_5_2_D, 0, 1.5);
    Script.WaitSec(3.0); 
    EntGame.ShowCaption(STR_LVL_5_2_E, 0, 3.0);
    Script.WaitSec(4.5);
                 	    		  
    end;    

-----------------------------------------------------------------------------

function Part4()

	--Camera.JumpToWaypoint(entCamera, "CamWptNN");
    --Camera.SetSpeed(entCamera, 0.0, 0.01);
    
    --INTO THE CAVE
    	
	Camera.SetSpeed(entCamera, 2.5, 0.1); 
	Camera.StopAtWaypoint(entCamera, "CamWptSS");
 
    Script.WaitSec(4);    
	animal1=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath2", 0, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal1, .7); 
    Animal.SetCoinMode(animal1, CM_SPAWNREL);       
	Script.WaitSec(1.0);
	EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "Path12", 0, ST_WPT_RUN, 0, 0, 0, 2);
	Leopard1=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "Path11", 0, ST_WPT_WALK, 0, 0, 0, 2.0);
	Animal.EnableFear(Leopard1, false);
	Entity.SetName(Leopard1, "Leopard1");
	
	Script.WaitSec(2.0);
	EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "Path13", 0, ST_WPT_RUN, 0, 0, 0, 2);		
	animal2=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath2", 1, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal2, 1.1); 
    Animal.SetCoinMode(animal2, CM_SPAWNREL);
	Script.WaitSec(1);	
	
	--Play animal sounds.
	Sound.Play(smpCaveSqueek, 1, 10, DS2_CENTER);
	
	animal4=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath2", 3, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal4, .4);
    Animal.SetCoinMode(animal4, CM_SPAWNREL); 
    Animal.FaceEntity(animal4, entCamera); 		
	animal3=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath2", 2, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal3, .9);
    Animal.SetCoinMode(animal3, CM_SPAWNREL); 		
	Script.WaitSec(3);
	Run("Leopard1");	
	Script.WaitSec(3);
	animal5=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath2", 4, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal5, 1.6);
    Animal.SetCoinMode(animal5, CM_SPAWNREL);         		
	Script.WaitSec(1);
	EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "Path14", 0, ST_WPT_RUN, 0, 0, 0, 2);	
	Script.WaitSec(1);
	animal6=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath2", 5, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal6, .5);
    Animal.SetCoinMode(animal6, CM_SPAWNREL);        
	Script.WaitSec(1.0);
	
	--Play animal sounds.
	Sound.Play(smpCaveSqueek, 1, 10, DS2_CENTER);
	
	animal7=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath3", 0, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal7, .7); 
    Animal.SetCoinMode(animal7, CM_SPAWNREL);
    Animal.FaceEntity(animal7, entCamera);      		
	Script.WaitSec(3.0);
	animal8=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath3", 1, ST_POPUP, 1.5, 0, 0, 1);     
    Animal.SetElvOffset(animal8, .5);
    Animal.SetCoinMode(animal8, CM_SPAWNREL);    		
	Leopard2=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath16", 1, ST_WPT_WALK, 0, 0, 0, 2.0);
	Animal.EnableFear(Leopard2, false);
    Animal.SetAutoChargeDist(Leopard2, 10);	
	Animal.SetAttackType(Leopard2, ATK_STRAFE); 
	Animal.SetStrafeAttackDist(Leopard2, 5); 	
	Entity.SetName(Leopard2, "Leopard2");
	Script.WaitSec(1.0);		
	Leopard3=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath16", 1, ST_WPT_WALK, 0, 2, 0, 2.0);
	Animal.EnableFear(Leopard3, false);
	Entity.SetName(Leopard3, "Leopard3");
	Leopard4=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath16", 1, ST_WPT_WALK, 0, -2, 0, 2.0);
	Animal.EnableFear(Leopard4, false);
	Entity.SetName(Leopard4, "Leopard4");		
	Script.WaitSec(1.0);
	Run("Leopard2");
	Script.WaitSec(1.0);
	Run("Leopard3");  
	Script.WaitSec(.5);  
	Run("Leopard4");	
	Script.WaitSec(1.5);	
	EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "Path15", 0, ST_WPT_RUN, 0, 0, 0, 2);
	Script.WaitSec(1.0);
	animal9=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath3", 2, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal9, 3.2);
    Animal.SetCoinMode(animal9, CM_SPAWNREL);   		
	Script.WaitSec(1.0);
	
	--Play animal sounds.
	Sound.Play(smpCaveSqueek, 1, 10, DS2_CENTER);
	
	animal30=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath3", 3, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal30, 3.2); 
    Animal.SetCoinMode(animal30, CM_SPAWNREL);
    Animal.FaceEntity(animal30, entCamera); 
    Script.WaitSec(1.0);   
	animal11=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "LongerPath3", 4, ST_POPUP, 2, 0, 0, 1);     
    Animal.SetElvOffset(animal11, 4.1);
    Animal.SetCoinMode(animal11, CM_SPAWNREL); 
    Animal.FaceEntity(animal11, entCamera);
	Script.WaitSec(2.5);
	EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath17", 0, ST_WPT_RUN, 0, 0, 0, 1.8);	
	Script.WaitSec(1.5);
	EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath17", 0, ST_WPT_RUN, 0, 0, 0, 1.8);	
	Script.WaitSec(1.5);
	EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath18", 0, ST_WPT_RUN, 0, 0, 0, 1.8);	
	Script.WaitSec(3.0);
	
	--Play animal sounds.
	Sound.Play(smpCaveSqueek, 1, 10, DS2_CENTER);
			
	Script.WaitSec(3.0);
	animal12=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "BunnyPath19", 0, ST_POPUP, 1, 0, 0, 1);     
    Animal.SetElvOffset(animal12, 1.2); 
    Animal.SetCoinMode(animal12, CM_SPAWNREL);
    Script.WaitSec(1.0);
    EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "BunnyPath20", 0, ST_WPT_RUN, 0, 0, 0, 1.0); 	
	animal13=EntGame.SpawnAnimalOnPath(AID_MEERKAT_M, "BunnyPath19", 1, ST_POPUP, 1, 0, 0, 1); 
    Animal.SetElvOffset(animal13, 1.1);
    Animal.SetCoinMode(animal13, CM_SPAWNREL); 
    Script.WaitSec(1.0);
    EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath20", 0, ST_WPT_RUN, 0, 0, 0, 1.5);      	
    Script.WaitSec(1.0);
    EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath20", 0, ST_WPT_RUN, 0, 0, 0, 1.5);	
    Script.WaitSec(3.0);
       
    end;    

-----------------------------------------------------------------------------

function Part5()

	--Camera.JumpToWaypoint(entCamera, "CamWptSS");
    --Camera.SetSpeed(entCamera, 0.0, 0.01);
    
    Camera.SetPanOffset(entCamera, 110, 0.5); 
    
    y1=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath21", 1, ST_WPT_RUN, 0, 0, 0, 2.5);
    Animal.FaceEntity(y1, entCamera); 
    Animal.SetAutoChargeDist(y1, 20);	
	Animal.SetAttackType(y1, ATK_STRAFE); 
	Animal.SetStrafeAttackDist(y1, 5); 
    Script.WaitSec(1.0);
    z2=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath21", 1, ST_WPT_RUN, 0, 0, 0, 2.8);
    Animal.FaceEntity(z2, entCamera);     
    Script.WaitSec(3.0);
    Camera.SetPanOffset(entCamera, 0, 1.5);
    Script.WaitSec(1.5);
	Camera.SetSpeed(entCamera, 2.5, 0.1); 
	Camera.StopAtWaypoint(entCamera, "CamWptTT");
    Script.WaitSec(1.5);
	
 	EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "BunnyPath22", 0, 0, 0, 0, .8);	   	
    EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "BunnyPath23", 0, 0, 0, 0, .8);	
    Script.WaitSec(.5);
	EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "BunnyPath22", 0, .5, -.5, .5, .8);
	Script.WaitSec(.5);	
    EntGame.SpawnBirdOnPath(AID_SPURWINGGOOSE_M, "BunnyPath23", 0, -.5, 0, -.5, .8);  
    Script.WaitSec(1.0);
    Camera.SetTiltOffset(entCamera, 15, 1.0); 	
    Script.WaitSec(3);
    Camera.SetTiltOffset(entCamera, 0, 1.0); 	
    Camera.SetPanOffset(entCamera, 10, 0.5);
    	
    EntGame.ShowCaption(STR_LVL_5_2_F, 0, 2.0);
    Script.WaitSec(3.5); 
    EntGame.ShowCaption(STR_LVL_5_2_G, 0, 3.0);
    Script.WaitSec(4.5);
   
    a1=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "BunnyPath25", 0, ST_WPT_RUN, 0, 0, 0, 0.3);
    Animal.FaceEntity(a1, entCamera);
    Script.WaitSec(2);
    a2=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "BunnyPath24", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(a2, entCamera);
    Script.WaitSec(2.0);
	animal1=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "BunnyPath26", 0, ST_WPT_RUN, 2, 0, 0, .5);     
    Animal.FaceEntity(animal1, entCamera); 
    Script.WaitSec(2.0);    	
    a3=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_F, "BunnyPath28", 0, ST_WPT_RUN, 0, 0, 0, 0.3);
    Animal.FaceEntity(a3, entCamera);
    Script.WaitSec(1.0);
    a4=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath31", 0, ST_WPT_RUN, 0, 0, 0, 2.0);
    Animal.FaceEntity(a4, entCamera);
    Animal.SetAutoChargeDist(a4, 15);	
	Animal.SetAttackType(a4, ATK_STRAFE); 
	Animal.SetStrafeAttackDist(a4, 5);  
    Script.WaitSec(3.0); 
   	a5=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "BunnyPath24", 0, ST_WPT_RUN, 0, 0, 0, 0.3); 
   	Animal.FaceEntity(a5, entCamera);	
    Script.WaitSec(1.5);
    a6=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "BunnyPath24", 0, ST_WPT_RUN, 0, 0, 0, 0.3);
    Animal.FaceEntity(a6, entCamera);	
    Script.WaitSec(1.0);
    a7=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_F, "BunnyPath26", 0, ST_WPT_RUN, 0, 0, 0, 0.3);	
    Animal.FaceEntity(a7, entCamera);
    Script.WaitSec(2);	
    a8=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "BunnyPath28", 0, ST_WPT_RUN, 0, 0, 0, 0.3);	
    Animal.FaceEntity(a8, entCamera);
    Script.WaitSec(2.0);
    a9=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath30", 0, ST_WPT_RUN, 0, 0, 0, 2.0);	
    Animal.FaceEntity(a9, entCamera);
    Animal.SetAutoChargeDist(a9, 15);	
	Animal.SetAttackType(a9, ATK_STRAFE); 
	Animal.SetStrafeAttackDist(a9, 5);  
    Script.WaitSec(2.5);
    a10=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "BunnyPath25", 0, ST_WPT_RUN, 0, 0, 0, 0.3);	
    Animal.FaceEntity(a10, entCamera);   
    Script.WaitSec(2);        
    a11=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "BunnyPath24", 0, ST_WPT_RUN, 0, 0, 0, 0.3);
    Animal.FaceEntity(a11, entCamera);
    Script.WaitSec(2);
    a12=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "BunnyPath24", 0, ST_WPT_RUN, 0, 0, 0, 0.5);
    Animal.FaceEntity(a12, entCamera);
    Script.WaitSec(2.0);
	a13=EntGame.SpawnAnimalOnPath(AID_SABLE_M, "BunnyPath28", 0, ST_WPT_RUN, 2, 0, 0, .5);     
    Animal.FaceEntity(a13, entCamera);
    a17=EntGame.SpawnAnimalOnPath(AID_SABLE_F, "BunnyPath31", 0, ST_WPT_RUN, 0, 0, 0, 0.3);
    Animal.FaceEntity(a17, entCamera);     
    Script.WaitSec(2.0);    	
    a14=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_F, "BunnyPath25", 0, ST_WPT_RUN, 0, 0, 0, 0.3);
    Animal.FaceEntity(a14, entCamera);
   	a16=EntGame.SpawnAnimalOnPath(AID_GEMSBOK_M, "BunnyPath30", 0, ST_WPT_RUN, 0, 0, 0, 0.3); 
   	Animal.FaceEntity(a16, entCamera);	
    Script.WaitSec(1.0);
    a15=EntGame.SpawnAnimalOnPath(AID_LEOPARD_M, "BunnyPath29", 0, ST_WPT_RUN, 0, 0, 0, 2.0);
    Animal.FaceEntity(a15, entCamera);
    Animal.SetAutoChargeDist(a15, 15);	
	Animal.SetAttackType(a15, ATK_STRAFE); 
	Animal.SetStrafeAttackDist(a15, 5);  
             	    		  
    end;    

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


