#TouhouDanmakufu [Single]
#Title[Noob Man NSC 03]
#Text[3eme NSC de Noob Man]
#BGM[script\DanMUku\Stage6\NoobMan.mp3]
#Player[script\DanMUku\Joueur\KorA\KorHosik.txt, script\DanMUku\Joueur\KorB\KorB.txt, script\DanMUku\Joueur\KorC\KorC.txt]
#ScriptVersion[2]

script_enemy_main {
    let imgEnemy="script\DanMUku\Stage6\Image\noobman.png";
    let count = -90;
    let angle = GetAngleToPlayer;
    let modulus = 0;
    let tir ="script\DanMUku\Stage1\Son\tir.wav";
    let x = GetX;

    @Initialize {
      LoadUserShotData("script\DanMUku\MUtir\MUtir.txt");
	LoadSE(tir);
	LoadGraphic(imgEnemy);
        SetLife(5000);
        SetDamageRate(100, 50);
        SetTimer(40);
        SetInvincibility(90);
        SetEnemyMarker(true); 
        MagicCircle(true);
        SetMovePosition02(GetCenterX, GetCenterY - 80, 60); 
        }

function exp(n) {
	return 2.71828^n;
}

    @MainLoop {
        SetCollisionA(GetX, GetY, 16); 
        SetCollisionB(GetX, GetY, 16);

        if(count % 5 == 0 && count >= 0){
	  PlaySE(tir);
          loop(2){
            ascent(i in 0..5){
		modulus = 50*exp(sin(angle));
              CreateShotA(1, GetX+modulus*cos(angle), GetY-30+modulus*sin(angle), 10);
              SetShotDataA(1, 0, 0, 2*angle, 0, 0, 0, 90);
              SetShotDataA(1, 100, 2+i*0.3, NULL, 0, 0, 0, 9);
              FireShot(1);

		if (count>=300) {
			modulus = 50*sin(angle/2);
		      CreateShotA(1, GetX+modulus*cos(angle), GetY+modulus*sin(angle), 10);
		      SetShotDataA(1, 0, 0, angle, 0, 0, 0, 82);
		      SetShotDataA(1, 100, 2-i*0.05, NULL, 0.2, 0, 0, 14);
		      FireShot(1);
			modulus = 50*cos(angle/2);
		      CreateShotA(1, GetX+modulus*cos(angle), GetY+modulus*sin(angle), 10);
		      SetShotDataA(1, 0, 0, angle, 0, 0, 0, 88);
		      SetShotDataA(1, 100, 2+i*0.05, NULL, -0.2, 0, 0, 18);
		      FireShot(1);
		}
		}
            angle+=360/2;
          }
          angle+=4.3;
        }

	if (count>0&&count%600==0){
		SetMovePositionRandom01(50, 50, 2, GetClipMinX+30, GetClipMinY+10, GetClipMaxX-30, GetCenterY-50);
	} 

        count++;
        yield;
    }

    @DrawLoop {
	if(x<GetX){
		SetGraphicAngle(0,0,0);
	}
	if(x>GetX){
		SetGraphicAngle(180,0,0);
	}
      x=GetX;
            SetColor(255,255,255);
            SetRenderState(ALPHA);
            SetTexture(imgEnemy);
	if (GetSpeed>0) {	
	            SetGraphicRect(28,0,55,34);
	}
	else {
		    SetGraphicRect(0,0,27,34);
	}

            DrawGraphic(GetX,GetY);

	DrawText("Noob Man", GetClipMinX+10, GetClipMinY+15, 12, 255);
    }

    @Finalize {
    }

    @BackGround {
    }
}
