script_enemy_main{
      #include_script".\Local.txt"
	let Enemy=csd~"img\dot_yousei.png";
        let shotData = csd ~ "data_usershot.txt";
   let arg = GetArgument;
 let effect = csd ~ "img\circle.png";
	@Initialize
	{

         SetLife(100);
            SetDamageRate(100,100);
            LoadGraphic(Enemy);
            
            LoadUserShotData(shotData);
      sgr(0,0);	
          SetInvincibility(0);
               Main;
	}
	
	@MainLoop{
               SetCollisionA(GetX(),GetY(),12);
		SetCollisionB(GetX(),GetY(),6);
		yield;
	}
	
       	@DrawLoop{
               SetTexture(Enemy);
		DrawGraphic(GetX,GetY);
	}

	@Finalize{ 
         if(!BeVanished){
             AddScore(100); 
   alternative(arg)
   case(31){
    CreateItem(ITEM_1UP,GetX,GetY);
     }
   others{
    CreateItem(ITEM_SCORE,GetX,GetY);
   }
             }
	}

         task Main{
             yield; 
       Shot;
     }

     task Shot{
 if(arg == 0){
    SetMovePosition02(GetX+200,GetY+90,60);
     } 
  else if(arg == 1){
   SetMovePosition02(GetX-200,GetY+90,60);
   }
   wait(120);
  let x = GetX; let y = GetY;
  let color = 8; let delay = 10;
    ascent(a in 0..20){
   let angle = GetAngleToPlayer+18*a;
      ascent(b in 0..2){
    let v = 3+3*b;
     CreateShot01(x,y,v,angle,color,delay);
      } 
      } 
    PlaySE(seshot3);
    SetMovePosition02(GetX,maxy+30,180);
   wait(180);
   VanishEnemy;
   }

     function offsetX(radius,angle){
           return radius * cos(angle);
     }

        function offsetY(radius,angle){
            return radius * sin(angle);
     }           

       function move(f){
          SetMovePosition02(rand(GetClipMinX+60,GetClipMaxX-60),GetY+rand(-20,20),f);
     }
            
        function sc(r,g,b){
             SetShotColor(r,g,b);
     }

  function sgr(a,b){SetGraphicRect(a*32,b*32,(a+1)*32,(b+1)*32);}

       function wait(w){
                loop(w){yield;}
       }
}