#東方弾幕風
#Title[波符「赤眼催眠(マインドシェイカー)」 Easy]
#Text[永夜抄5面:鈴仙スペルのクローン]
#ScriptVersion[2]

script_enemy_main {
    let name       = "波符「赤眼催眠(マインドシェイカー)」";
    let imgBoss    = "script\img\ExRumia.png";

    // 初期位置
    let xIni       = GetCenterX;
    let yIni       = GetClipMinY + 128;

    @Initialize {
        CutIn(YOUMU, name, "", 0, 0, 0, 0);

        SetLife(2000);
        SetTimer(49);
        SetScore(25000000);
        SetDamageRate(5, 5);

        LoadGraphic(imgBoss);
        SetTexture(imgBoss);
        setGraphicStop;

        TMain;
    }

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

        yield;
    }

    @DrawLoop {
        DrawGraphic(GetX, GetY);
    }

    @Finalize {
        DeleteGraphic(imgBoss);
    }

    // メインタスク
    task TMain {
        let typeRed  = RED11;
        let typeBlue = BLUE11;
        let wShot1   = 50;
        let wShot2   = 25;

        yield;

        TRate;
        standBy;

        loop {
            shot1(1, typeRed);
            wait(wShot1);
            phantasm;

            shot2([1.25, 0.95], typeRed);
            wait(wShot2);

            shot2([1.05, 0.85], typeBlue);
            wait(wShot2);
        }
    }

    // ダメージレートの変更
    task TRate {
        wait(500);
        SetDamageRate(60, 60);
    }

    // 初期位置へ移動し、攻撃開始
    sub standBy {
        let wIni = 120;

        SetMovePosition02(xIni, yIni, wIni);
        setGraphicMove;

        SetInvincibility(wIni);
        wait(wIni);

        setGraphicPose;
    }

    // 1重の円状 n-way 弾
    //   v    : 速度
    //   type : 弾のタイプ
    function shot1(v, type) {
        let dir   = rand(-180, 180);
        let right = true;

        loop(2) {
            nwayCircle(48, v, dir, type, right);

            dir  += 3.75;
            right = ! right;
        }
    }

    // 2重の円状 n-way 弾
    //   v    : 速度(要素数2の配列)
    //   type : 弾のタイプ
    function shot2(v, type) {
        let dir   = rand(-180, 180);
        let right = true;
        let i     = 0;

        loop(2) {
            loop(2) {
                nwayCircle(24, v[i], dir, type, right);

                dir  += 3.75;
                right = ! right;
            }
            i++;
        }
    }

    // 幻視
    sub phantasm {
        wait(100);
    }

    // 円状 n-way 弾
    //   way   : way 数
    //   v     : 速度
    //   dir   : 基準とする方向
    //   type  : 弾のタイプ
    //   right : 幻視で右に移動するかどうか
    function nwayCircle(way, v, dir, type, right) {
        let span  = 360 / way;
        let angle = dir;

        loop(way) {
            CreateShot01(GetX, GetY, v, angle, type, 0);
            angle += span;
        }
    }

    // グラフィックの設定
    sub setGraphicStop  { SetGraphicRect(  0,   0,  64,  64); }
    sub setGraphicPose  { SetGraphicRect( 64,   0, 128,  64); }
    sub setGraphicLeft  { SetGraphicRect(128,   0, 192,  64); }
    sub setGraphicRight { SetGraphicRect(192,   0, 256,  64); }

    sub setGraphicMove {
        if(GetSpeedX < 0) {
            setGraphicLeft;
        } else {
            setGraphicRight;
        }
    }

    // w フレームだけ待つ
    function wait(w) {
        loop(w) { yield; }
    }
}

戻る

この講座はロベールが作成しました。