#TouhouDanmakufu [Single]
#Title[Noob Man NSC 02]
#Text[2eme 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 = -120;
    let angle = 0;
    let tir ="script\DanMUku\Stage1\Son\tir.wav";
    let laser = "script\DanMUku\Stage2\Son\laser.wav";
    let x = GetX;

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


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


	if (count>0&&count%8==0) {
		CreateLaser01(GetX+cos(angle)*40, GetY+sin(angle)*40, 4, (angle+rand(0,5))*2, 100, 10, 9, 0);
		CreateLaser01(GetX+cos(angle+90)*40, GetY+sin(angle+90)*40, 4, (angle+90+rand(0,5))*2, 100, 10, 9, 0);
		angle+=180;
		CreateLaser01(GetX+cos(angle)*40, GetY+sin(angle)*40, 4, (angle-rand(0,5))*2, 100, 10, 9, 0);
		CreateLaser01(GetX+cos(angle+90)*40, GetY+sin(angle+90)*40, 4, (angle+90-rand(0,5))*2, 100, 10, 9, 0);
		angle+=6.7;
	}

	if (count>0&&count%16==0) {
		PlaySE(tir);
	}

	if (count>0&&count%200==0) {
		PlaySE(laser);
		ascent (i in 0..5) {
			CreateLaserC(1, GetX, GetY, 10, 100, 14, 0);
			SetLaserDataC(1, 0, 3, GetAngleToPlayer-10+i*72, 0, 0, 2);
			SetLaserDataC(1, 80, NULL, NULL, 10, 0, 2);
			SetLaserDataC(1, 98, NULL, NULL, 0, 0, 2);
			SetLaserDataC(1, 148, NULL, NULL, -1, 0, 2);
			SetLaserDataC(1, 250, NULL, NULL, 0, 0, 2);
			FireShot(1);

			CreateLaserC(2, GetX, GetY, 10, 100, 18, 0);
			SetLaserDataC(2, 0, 3, GetAngleToPlayer+10+i*72, 0, 0, 2);
			SetLaserDataC(2, 80, NULL, NULL, -10, 0, 2);
			SetLaserDataC(2, 98, NULL, NULL, 0, 0, 2);
			SetLaserDataC(2, 148, NULL, NULL, 1, 0, 2);
			SetLaserDataC(2, 250, NULL, NULL, 0, 0, 2);
			FireShot(2);
		}
	}


        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 {
    }
}
