#BackGround[Default]
#Player[FREE]
#BGM[.\BGM\th06_11.wav]
#ScriptVersion[2]

script_enemy_main {
    let imgBoss   = GetCurrentScriptDirectory~".\img\Sakuya.png";
    let frame     =  0;
    let frame2 = 0;
    let angle = 90;
    let angle2 = 90;
    let shootSE = GetCurrentScriptDirectory~".\SE\shoot13.wav";
    

  //̓t[𐔂Ă܂B
  let BossY = GetClipMinY + 120;
  //ɂ͓G̓oʒuYĂB
  let MoveF = 180;
  //ɂ͉t[Ɉړ邩ĂB
  
  function Qif (YesR,NoR,Quest) {
  //Qif(̕ԓ,s̕ԓ,)
  if (Quest) {return(YesR)}else{return(NoR)}
  }
   
    @Initialize {
        SetLife(3000);
	SetMovePosition02(224,90,60);
        SetTimer(50);//Ԑ30bɐݒ
        SetMovePosition02(224,90,60);
        LoadGraphic(imgBoss);
        SetTexture(imgBoss);
        SetGraphicRect(0, 0, 44, 86);}

    @MainLoop {
frame++;
frame2++;
        SetCollisionA(GetX, GetY, 24);
        SetCollisionB(GetX, GetY, 24);
  if((frame2-60)%MoveF==0&&MoveF!=0){
  SetMovePosition02(GetX()+(Qif(1,-1,GetX<=GetPlayerX)*rand(40,60)),rand(BossY-40,BossY+40),60);
  }
 if (frame==40){  
PlaySE(shootSE);
loop(40){
SetShotDirectionType(PLAYER);
CreateShot01(GetX(),GetY(),3,0+angle2,PURPLE32,0);
CreateShot01(GetX(),GetY(),3,-20+angle2,PURPLE32,0);
CreateShot01(GetX(),GetY(),3,20+angle2,PURPLE32,0);
angle2 += 9;
angle += 9;}
frame=0;
 }
	}

    @DrawLoop {
        DrawGraphic(GetX, GetY);
    }

    @Finalize {
        DeleteGraphic(imgBoss);
	DeleteSE(shootSE);
    }
}
