野符「武烈クライシス」.h.txt
let csd     = GetCurrentScriptDirectory;
let imgFam  = csd ~ "img\familiar.png";

// 使い魔の配置に必要な時間
let wSetFam = 30;

// w フレームだけ待つ
function wait(w) {
    loop(w) { yield; }
}
#東方弾幕風
#Title[野符「武烈クライシス」]
#Text[永夜抄3面:慧音スペルのクローン]
#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(33);
        SetScore(20000000);
        SetDamageRate(5, 5);

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

        TMain;
    }

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

        yield;
    }

    @DrawLoop {
        DrawGraphic(GetX, GetY);
    }

    @Finalize {
        DeleteGraphic(imgBoss);
        DeleteGraphic(imgFam);
    }

    // メインタスク
    task TMain {
        yield;

        TRate;
        standBy;
        setFam;
    }

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

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

        SetMovePosition02(xIni, yIni, wIni);
        setGraphicMove;

        SetInvincibility(wIni);
        wait(wIni);

        setGraphicPose;
    }

    // 使い魔をセット
    sub setFam {
        // 使い魔の三角形の中心位置
        // x 座標は中心からの距離になっています。
        let xFamCenter = (GetCenterX - GetClipMinX) / 2;
        let yFamCenter = yIni;

        // 使い魔の位置(中心からの向き)
        let angleFam   = [0, 120, -120];

        ascent(i in 0..3) {
            CreateEnemyFromScript("Familiar", GetCenterX - xFamCenter, yFamCenter,
                                  0, angleFam[i], 1);
        }

        ascent(i in 0..3) {
            CreateEnemyFromScript("Familiar", GetCenterX + xFamCenter, yFamCenter,
                                  0, angleFam[i] + 180, -1);
        }

        wait(wSetFam);
    }

    // グラフィックの設定
    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;
        }
    }

    #include_function ".\野符「武烈クライシス」.h.txt"
}

// 使い魔
script_enemy Familiar {
    // 使い魔の中心位置
    let xCenter = GetX;
    let yCenter = GetY;

    // 中心位置からの距離と角度
    // 実際の角度は angBase + angle になります。
    let r       = 0;
    let angBase = GetAngle;
    let angle   = 0;

    // 移動方向(±1)
    let dir     = GetArgument;

    @Initialize {
        SetLife(2000);
        SetScore(10000);
        SetDamageRate(50, 50);

        SetTexture(imgFam);
        setGraphicFast;

        TMain;
    }

    @MainLoop {
        if(GetKeyState(VK_SLOWMOVE) == KEY_HOLD) {
            setGraphicSlow;
        } else {
            SetCollisionA(GetX, GetY, 32);
            setGraphicFast;
        }

        yield;
    }

    @DrawLoop {
        DrawGraphic(GetX, GetY);
    }

    task TMain {
        yield;

        standBy;
    }

    // 初期位置へ移動
    sub standBy {
        let dr =  32 / wSetFam;    // 動径方向の速度
        let w  = 210 / wSetFam;    // 角速度

        loop(wSetFam) {
            r += dr;
            move(w);
            yield;
        }
    }

    // 次の位置へ移動
    //   w : 角速度
    function move(w) {
        angle += w * dir;

        SetX(xCenter + r * cos(angBase + angle));
        SetY(yCenter + r * sin(angBase + angle));
        SetGraphicAngle(0, 0, angle);    // グラフィックを傾けます
    }

    // グラフィックの設定
    sub setGraphicFast { SetGraphicRect( 0,  0, 48, 48); }
    sub setGraphicSlow { SetGraphicRect( 0, 48, 48, 96); }

    #include_function ".\野符「武烈クライシス」.h.txt"
}

戻る

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