#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);
        SetTimer(30);//Ԑ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==90){  
PlaySE(shootSE);
loop(60){
CreateShot01(GetX(),GetY(),2,angle,PURPLE32,0);
SetShotDirectionType(PLAYER);
CreateShot01(GetX(),GetY(),1,0+angle2,RED32,0);
angle2 += 6;
angle += 6;}
frame=0;
 }
	}

    @DrawLoop {
        DrawGraphic(GetX, GetY);
    }

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