#뱦뺴뭙뼀븮
#Title[맻뛱럾뾊갲럔 믅륂B]
#Text[]
#ScriptVersion[2]

script_enemy_main {
    let imgBoss   = "script\img\dot_yuyuko.png";
    let frame     =  0;
    let angleBase = 90;
    let angleBase2 = 90;
    let bgm       = "script\bgm\mkei_yuuga02.mp3";
    let shot1se   = "script\se\Shot00.wav";
    let shot2se   = "script\se\Shot02.wav";
    let laserse   = "script\se\Laser.wav";
    PlayMusic(bgm);


    @Initialize {
        SetX(GetCenterX);
        SetY(GetClipMinY + 120);
        SetLife(2000);

        LoadGraphic(imgBoss);
        SetTexture(imgBoss);
        SetGraphicRect(0, 0, 128, 128);
    }

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

        frame++;
        if(frame == 1) {
            nway(angleBase, 2, 55, GREEN22);PlaySE(shot1se);
            angleBase += 15;
        } else if(frame == 2) {
            nway(angleBase2, 4, 20, RED22);PlaySE(shot1se);
            angleBase2 -= 11;
            frame = 0;
        }
    }

    @DrawLoop {
        DrawGraphic(GetX, GetY);
    }

    @Finalize {
        DeleteGraphic(imgBoss);
    }

    function nway(let dir, let way, let span, let color) {
        let angle = dir - (way - 1) / 2 * span;
        loop(way) {
            CreateShot01(GetX, GetY, 2.5, angle, color, 0);
            angle += span;
        }
    }
}