
	#Title[zako1]
	#Text[zako]
	#ScriptVersion[2]
	
	script_enemy_main
	{
        let img = "script\ザコ\zako4.PNG";
        let frame = 0;
         let ang=0;
let scoa=0;
      LoadCommonData;
		@Initialize
		{ 
              SetLife(4000);
              SetTimer(90);
              
           SetEffectForZeroLife(0,0,0);
              LoadGraphic(img);
              SetTexture(img);  SetGraphicRect(0, 0, 64, 64);
             TMain;
		
		}
			
		@MainLoop
		{
             
    SetCollisionA(GetX, GetY, 24);
    SetCollisionB(GetX, GetY, 24);
   yield;


		}
		
		@DrawLoop
		{
		   DrawGraphic(GetX, GetY);
		}
			
		@Finalize
		{
if(scoa==0){
AddScore(500+500*GetPlayerLife);scoa=1;}
		}
         task TMain{
               yield;
    SetMovePosition02(GetX,GetClipMinY+90, 60);
        loop(60){yield;}

                          CreateEnemyFromScript("zako1", GetX, GetY, 0, 0, 0);
                          CreateEnemyFromScript("zako2", GetX, GetY, 0, 0, 0);
                          CreateEnemyFromScript("zako3", GetX, GetY, 0, 0, 0);
                          CreateEnemyFromScript("zako4", GetX, GetY, 0, 0, 0);
                           loop(90){yield;}

          loop{
   SetMovePosition02(GetX+120,GetY+90, 90);
        loop(120){yield;}
   SetMovePosition02(GetX-240,GetY-90, 90);
        loop(120){yield;}
   SetMovePosition02(GetX+120,GetY+90, 90);
        loop(120){yield;}
   SetMovePosition02(GetX+120,GetY-90, 90);
        loop(120){yield;}
   SetMovePosition02(GetX-240,GetY+90, 90);
        loop(120){yield;}
   SetMovePosition02(GetX+120,GetY-90, 90);
        loop(90){yield;}
loop(12){
if(GetLife<1000){
CreateShot02(GetX,GetY,14,ang,-0.8,4,RED04,10);
CreateShot02(GetX,GetY,14,ang+5,-0.8,4,ORANGE04,10);
CreateShot02(GetX,GetY,14,ang+10,-0.8,4,YELLOW04,10);
CreateShot02(GetX,GetY,14,ang+15,-0.8,4,GREEN04,10);
CreateShot02(GetX,GetY,14,ang-10,-0.8,4,RED04,20);
CreateShot02(GetX,GetY,14,ang+5-10,-0.8,4,ORANGE04,20);
CreateShot02(GetX,GetY,14,ang+10-10,-0.8,4,YELLOW04,20);
CreateShot02(GetX,GetY,14,ang+15-10,-0.8,4,GREEN04,20);
}
CreateShot02(GetX,GetY,14,ang+10-10,-0.8,4,RED04,30);
CreateShot02(GetX,GetY,14,ang+5+10,-0.8,4,ORANGE04,30);
CreateShot02(GetX,GetY,14,ang+10+10,-0.8,4,YELLOW04,30);
CreateShot02(GetX,GetY,14,ang+15+10,-0.8,4,GREEN04,30);
ang=ang+30
}
        loop(30){yield;}
           }
                    
 
                   }

                 
        sub nige{ 

             VanishEnemy;
                }
	}
  
	script_enemy  zako1
	{
        let img = "script\ザコ\zako3.PNG";
        let frame = 0;

      LoadCommonData;
		@Initialize
		{ 
              SetLife(2000);
              SetScore(0);
     SetCoordinateType(COODINATE_TYPE_PARENT);
              LoadGraphic(img);
              SetTexture(img);  SetGraphicRect(0, 0, 64, 64);
             TMain;
		
		}
			
		@MainLoop
		{
    SetCollisionA(GetX, GetY, 24);
    SetCollisionB(GetX, GetY, 24);
   yield;


		}
		
		@DrawLoop
		{
		   DrawGraphic(GetX, GetY);
		}
			
		@Finalize
		{

		}
         task TMain{
               yield;
                   move;
                    shot;
                    

                   }
         task move{ let x =90;
                   let y =rand(240, 48);
     SetMovePosition02(x, 90-x,30);
        loop(30) { yield; }
loop{
loop(90){
     SetMovePosition02(x, 90-x,1);
        loop(1) { yield; }
x=x-1;
 }   
loop(90){
     SetMovePosition02(-x, 90-x,1);
        loop(1) { yield; }
x=x+1;
 }     
loop(90){
     SetMovePosition02(-x, -90+x,1);
        loop(1) { yield; }
x=x-1;
 }   
loop(90){
     SetMovePosition02(x, -90+x,1);
        loop(1) { yield; }
x=x+1;
 }                 
}
     }
task shot2{
	let toAngle=atan2(GetEnemyY()-GetY, GetEnemyX()-GetX);
toAngle=atan2(GetY-GetEnemyY(), GetX-GetEnemyX());
CreateLaserB(359,300,30,RED01,60);
SetLaserDataB(359,0,0,0,0,0,0,toAngle,1);
SetShotKillTime(359,90);
FireShot(359);


}


         task shot{  loop{ let a=rand(10,90);  
        loop(60) { yield; } 
if(GetEnemyLife>3000){
CreateShot02(GetX,GetY,1,GetAngleToPlayer,0.1,5,RED02,0);
}
if(GetEnemyLife>2000&&GetEnemyLife<3000){
CreateShot02(GetX,GetY,12,GetAngleToPlayer+10,-0.6,3,RED01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer+5,-0.6,3,RED01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer,-0.6,3,RED01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer-5,-0.6,3,RED01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer-10,-0.6,3,RED01,0);
}
if(GetEnemyLife<=2000){
shot2;
}
        loop(30) { yield; } 
                 }}
        sub nige{ 
              SetMovePosition02(GetX, GetClipMaxY, 180);
        loop(180) { yield; } 
             VanishEnemy;
                }
	}
  	script_enemy  zako2
	{
        let img = "script\ザコ\zako3.PNG";
        let frame = 0;

      LoadCommonData;
		@Initialize
		{ 
              SetLife(2000);
              SetScore(0);
     SetCoordinateType(COODINATE_TYPE_PARENT);
              LoadGraphic(img);
              SetTexture(img);  SetGraphicRect(0, 0, 64, 64);
             TMain;
		
		}
			
		@MainLoop
		{
    SetCollisionA(GetX, GetY, 24);
    SetCollisionB(GetX, GetY, 24);
   yield;


		}
		
		@DrawLoop
		{
		   DrawGraphic(GetX, GetY);
		}
			
		@Finalize
		{

		}
         task TMain{
               yield;
                   move;
                    shot;
                    

                   }
         task move{ let x =0;
                   let y =rand(240, 48);
     SetMovePosition02(-x, 90-x,30);
        loop(30) { yield; }
loop{

loop(90){
     SetMovePosition02(-x, 90-x,1);
        loop(1) { yield; }
x=x+1;
 }     
loop(90){
     SetMovePosition02(-x, -90+x,1);
        loop(1) { yield; }
x=x-1;
 }   
loop(90){
     SetMovePosition02(x, -90+x,1);
        loop(1) { yield; }
x=x+1;
 }  
loop(90){
     SetMovePosition02(x, 90-x,1);
        loop(1) { yield; }
x=x-1;
 }                  
}
     }
task shot2{
	let toAngle=atan2(GetEnemyY()-GetY, GetEnemyX()-GetX);
toAngle=atan2(GetY-GetEnemyY(), GetX-GetEnemyX());
CreateLaserB(359,300,30,ORANGE01,60);
SetLaserDataB(359,0,0,0,0,0,0,toAngle,1);
SetShotKillTime(359,90);
FireShot(359);


}


         task shot{  loop{ let a=rand(10,90);  
        loop(60) { yield; } 
if(GetEnemyLife>3000){
CreateShot02(GetX,GetY,1,GetAngleToPlayer,0.1,5,ORANGE02,0);
}
if(GetEnemyLife>2000&&GetEnemyLife<3000){
CreateShot02(GetX,GetY,12,GetAngleToPlayer+10,-0.6,3,ORANGE01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer+5,-0.6,3,ORANGE01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer,-0.6,3,ORANGE01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer-5,-0.6,3,ORANGE01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer-10,-0.6,3,ORANGE01,0);
}
if(GetEnemyLife<=2000){
shot2;
}
        loop(30) { yield; } 
                 }}
        sub nige{ 
              SetMovePosition02(GetX, GetClipMaxY, 180);
        loop(180) { yield; } 
             VanishEnemy;
                }
	}
 	script_enemy  zako3
	{
        let img = "script\ザコ\zako3.PNG";
        let frame = 0;

      LoadCommonData;
		@Initialize
		{ 
              SetLife(2000);
              SetScore(0);
     SetCoordinateType(COODINATE_TYPE_PARENT);
              LoadGraphic(img);
              SetTexture(img);  SetGraphicRect(0, 0, 64, 64);
             TMain;
		
		}
			
		@MainLoop
		{
    SetCollisionA(GetX, GetY, 24);
    SetCollisionB(GetX, GetY, 24);
   yield;


		}
		
		@DrawLoop
		{
		   DrawGraphic(GetX, GetY);
		}
			
		@Finalize
		{

		}
         task TMain{
               yield;
                   move;
                    shot;
                    

                   }
         task move{ let x =90;
                   let y =rand(240, 48);
     SetMovePosition02(-x, -90+x,30);
        loop(30) { yield; }
loop{


loop(90){
     SetMovePosition02(-x, -90+x,1);
        loop(1) { yield; }
x=x-1;
 }   
loop(90){
     SetMovePosition02(x, -90+x,1);
        loop(1) { yield; }
x=x+1;
 }  
loop(90){
     SetMovePosition02(x, 90-x,1);
        loop(1) { yield; }
x=x-1;
 }       
loop(90){
     SetMovePosition02(-x, 90-x,1);
        loop(1) { yield; }
x=x+1;
 }                
}
     }
    task shot2{
	let toAngle=atan2(GetEnemyY()-GetY, GetEnemyX()-GetX);
toAngle=atan2(GetY-GetEnemyY(), GetX-GetEnemyX());
CreateLaserB(359,300,30,YELLOW01,60);
SetLaserDataB(359,0,0,0,0,0,0,toAngle,1);
SetShotKillTime(359,90);
FireShot(359);


}


         task shot{  loop{ let a=rand(10,90);  
        loop(60) { yield; } 
if(GetEnemyLife>3000){
CreateShot02(GetX,GetY,1,GetAngleToPlayer,0.1,5,YELLOW02,0);
}
if(GetEnemyLife>2000&&GetEnemyLife<3000){
CreateShot02(GetX,GetY,12,GetAngleToPlayer+10,-0.6,3,YELLOW01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer+5,-0.6,3,YELLOW01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer,-0.6,3,YELLOW01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer-5,-0.6,3,YELLOW01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer-10,-0.6,3,YELLOW01,0);
}
if(GetEnemyLife<=2000){
shot2;
}
        loop(30) { yield; } 
                 }}
        sub nige{ 
              SetMovePosition02(GetX, GetClipMaxY, 180);
        loop(180) { yield; } 
             VanishEnemy;
                }
	}
	script_enemy  zako4
	{
        let img = "script\ザコ\zako3.PNG";
        let frame = 0;

      LoadCommonData;
		@Initialize
		{ 
              SetLife(2000);
              SetScore(0);
     SetCoordinateType(COODINATE_TYPE_PARENT);
              LoadGraphic(img);
              SetTexture(img);  SetGraphicRect(0, 0, 64, 64);
             TMain;
		
		}
			
		@MainLoop
		{
    SetCollisionA(GetX, GetY, 24);
    SetCollisionB(GetX, GetY, 24);
   yield;


		}
		
		@DrawLoop
		{
		   DrawGraphic(GetX, GetY);
		}
			
		@Finalize
		{

		}
         task TMain{
               yield;
                   move;
                    shot;
                    

                   }
         task move{ let x =0;
                   let y =rand(240, 48);
     SetMovePosition02(x, -90+x,30);
        loop(30) { yield; }
loop{



loop(90){
     SetMovePosition02(x, -90+x,1);
        loop(1) { yield; }
x=x+1;
 }  
loop(90){
     SetMovePosition02(x, 90-x,1);
        loop(1) { yield; }
x=x-1;
 }       
loop(90){
     SetMovePosition02(-x, 90-x,1);
        loop(1) { yield; }
x=x+1;
 }        
loop(90){
     SetMovePosition02(-x, -90+x,1);
        loop(1) { yield; }
x=x-1;
 }           
}
     }
     task shot2{
	let toAngle=atan2(GetEnemyY()-GetY, GetEnemyX()-GetX);
toAngle=atan2(GetY-GetEnemyY(), GetX-GetEnemyX());
CreateLaserB(359,300,30,GREEN01,60);
SetLaserDataB(359,0,0,0,0,0,0,toAngle,1);
SetShotKillTime(359,90);
FireShot(359);


}


         task shot{  loop{ let a=rand(10,90);  
        loop(60) { yield; } 
if(GetEnemyLife>3000){
CreateShot02(GetX,GetY,1,GetAngleToPlayer,0.1,5,GREEN02,0);
}
if(GetEnemyLife>2000&&GetEnemyLife<3000){
CreateShot02(GetX,GetY,12,GetAngleToPlayer+10,-0.6,3,GREEN01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer+5,-0.6,3,GREEN01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer,-0.6,3,GREEN01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer-5,-0.6,3,GREEN01,0);
CreateShot02(GetX,GetY,12,GetAngleToPlayer-10,-0.6,3,GREEN01,0);
}
if(GetEnemyLife<=2000){
shot2;
}
        loop(30) { yield; } 
                 }}
        sub nige{ 
              SetMovePosition02(GetX, GetClipMaxY, 180);
        loop(180) { yield; } 
             VanishEnemy;
                }
	}