script_enemy_main {

let frame1 = 0;
let frame2 = 0;
let frame3 = 0;
let frame4 = 0;
let frame5 = 0;
let frame6 = 0;
let frame7 = 0;
let frame8 = 0;
let frame9 = 0;
let frame10 = 0;
let frame11 = 0;
let anim1 = 30;
let anim2 = 0;
let anim3 = 0;
let a1 = 0;
let a2 = 0;
let a3 = 0;
let a4 = 0;
let a5 = 0;
let a6 = 0;
let a7 = 0;
let a8 = 0;
let acc1 = 0;
let acc2 = 0;
let acc3 = 0;
let acc4 = 0;
let acc5 = 0;
let acc6 = 0;
let acc7 = 0;
let acc8 = 0;
let acc9 = 0;
let acc10 = 0;
let acc11 = 0;
let acc12 = 0;
let kospin = 0;

let SP = GetCurrentScriptDirectory~"sp\sp.png";
let Custom = GetCurrentScriptDirectory~"sup\supershot.txt";
let sh1 = GetCurrentScriptDirectory~"se\BulletWave.wav";
let sh2 = GetCurrentScriptDirectory~"se\BulletWave.wav";

    @Initialize {

SetMovePosition03(GetX, GetCenterY, 10, 5);
LoadUserShotData(Custom);
LoadSE(sh1);
LoadSE(sh2);

SetLife(400);
    }

    @MainLoop {
SetCollisionA(GetX, GetY, 32);
SetCollisionB(GetX, GetY, 24);
        if (frame1 == 111)
        { 
        loop(1)
        {
            CreateShot02(GetX+30*cos(a1+90),GetY+30*sin(a1+90),1,a1+90,-0.02,1,45,10);
            CreateShot02(GetX+30*cos(-a1+90),GetY+30*sin(-a1+90),1,-a1+90,-0.02,1,45,10);
            a1 += 360/1;
        }
	a1 += 20;
	acc4 += 13;
	PlaySE(sh1);
	frame1 = 101;
        }
	if (frame2 == 111){
SetMovePosition03(GetX, GetClipMinY-100, 10, 1);
}
	if (frame2 == 360){VanishEnemy;}
        frame1++;
        frame2++;
        frame3++;
        frame4++;
    }

    @DrawLoop {
anim1++;
if (anim1 >= 30 && anim1 <= 40 && GetSpeedX == 0){
SetTexture(SP);
SetRenderState(ALPHA);
SetGraphicAngle(0,0,0);
SetGraphicScale(1,1);
SetGraphicRect(0, 449, 67, 511);
SetAlpha(255);
DrawGraphic(GetX, GetY);
}
if (anim1 >= 40 && anim1 <= 50 && GetSpeedX == 0){
SetTexture(SP);
SetRenderState(ALPHA);
SetGraphicAngle(0,0,0);
SetGraphicScale(1,1);
SetGraphicRect(67, 449, 127, 511);
SetAlpha(255);
DrawGraphic(GetX, GetY);
}
if (anim1 >= 50 && anim1 <= 60 && GetSpeedX == 0){
SetTexture(SP);
SetRenderState(ALPHA);
SetGraphicAngle(0,0,0);
SetGraphicScale(1,1);
SetGraphicRect(127, 449, 192, 511);
SetAlpha(255);
DrawGraphic(GetX, GetY);
}


if (anim1 >= 30 && anim1 <= 40 && GetSpeedX > 0){
SetTexture(SP);
SetRenderState(ALPHA);
SetGraphicAngle(0,0,0);
SetGraphicScale(1,1);
SetGraphicRect(322, 449, 384, 511);
SetAlpha(255);
DrawGraphic(GetX, GetY);
}
if (anim1 >= 40 && anim1 <= 50 && GetSpeedX > 0){
SetTexture(SP);
SetRenderState(ALPHA);
SetGraphicAngle(0,0,0);
SetGraphicScale(1,1);
SetGraphicRect(384, 449, 448, 511);
SetAlpha(255);
DrawGraphic(GetX, GetY);
}
if (anim1 >= 50 && anim1 <= 60 && GetSpeedX > 0){
SetTexture(SP);
SetRenderState(ALPHA);
SetGraphicAngle(0,0,0);
SetGraphicScale(1,1);
SetGraphicRect(448, 449, 508, 511);
SetAlpha(255);
DrawGraphic(GetX, GetY);
}




if (anim1 >= 30 && anim1 <= 40 && GetSpeedX < 0){
SetTexture(SP);
SetRenderState(ALPHA);
SetGraphicAngle(0,0,0);
SetGraphicScale(-1,1);
SetGraphicRect(322, 449, 384, 511);
SetAlpha(255);
DrawGraphic(GetX, GetY);
}
if (anim1 >= 40 && anim1 <= 50 && GetSpeedX < 0){
SetTexture(SP);
SetRenderState(ALPHA);
SetGraphicAngle(0,0,0);
SetGraphicScale(-1,1);
SetGraphicRect(384, 449, 448, 511);
SetAlpha(255);
DrawGraphic(GetX, GetY);
}
if (anim1 >= 50 && anim1 <= 60 && GetSpeedX < 0){
SetTexture(SP);
SetRenderState(ALPHA);
SetGraphicAngle(0,0,0);
SetGraphicScale(-1,1);
SetGraphicRect(448, 449, 508, 511);
SetAlpha(255);
DrawGraphic(GetX, GetY);
}
if (anim1 == 60){
anim1 = 30;
}
acc1 += 13;
acc2 += 9;
 }
    @Finalize {
PlaySE(GetCurrentScriptDirectory~"se\explode.wav");
loop(5){
}
    }
}
