Fandom

Touhou Wiki

Touhou Danmakufu: Simple Script

7,297pages on
this wiki
Add New Page
Talk0 Share

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.


Example

#TouhouDanmakufu
#Title[Test Sign "Test"]
#Text[Test script]
#Player[FREE]
#ScriptVersion[2]

script_enemy_main {
    let ImgBoss = "script\img\ExRumia.png";

    let frame = -120;

    @Initialize {
        SetLife(2000);
        SetTimer(50);
        SetScore(1000000);

        SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);
        CutIn(YOUMU, "Test Sign "\""Test"\", "", 0, 0, 0, 0);

        LoadGraphic(ImgBoss);
        SetTexture(ImgBoss);
        SetGraphicRect(0, 0, 64, 64);
    }

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

        if(frame == 10) {
            CreateShot01(GetX, GetY, 5, GetAngleToPlayer, RED01, 0);
            frame = 0;
        }
        frame++;
    }

    @DrawLoop {
        DrawGraphic(GetX, GetY);
    }

    @Finalize {
        DeleteGraphic(ImgBoss);
    }
}


Header

#TouhouDanmakufu

This directive is required.

#Title[Test Sign "Test"]
#Text[Test script]

The title and description of the spell card.

#Player[FREE]

All the characters can be used.

#ScriptVersion[2]

The required script version is 2.


Variables

    let ImgBoss = "script\img\ExRumia.png";

Path of the boss graphic.

    let frame = -120;

Frame count.


Initialization

        SetLife(2000);
        SetTimer(50);
        SetScore(1000000);

Set enemy's life, time limit, and score (spell card bonus).

        SetMovePosition02(GetCenterX, GetClipMinY + 120, 120);

Move enemy to the first position for 120 frames.

        CutIn(YOUMU, "Test Sign "\""Test"\", "", 0, 0, 0, 0);

Show the cut-in of the spell card as Touhou Youyoumu ~ Perfect Cherry Blossom. In this case, the cut-in graphic is not used.

        LoadGraphic(ImgBoss);
        SetTexture(ImgBoss);
        SetGraphicRect(0, 0, 64, 64);

Load the boss graphic and prepare to draw it. All the graphics used in the script must be loaded with LoadGraphic before drawing. SetTexture and SetGraphicRect indicate the graphic and the drawing range, respectively.


Main Loop

        SetCollisionA(GetX, GetY, 32);
        SetCollisionB(GetX, GetY, 16);

Set collision detection circles. SetCollisionA indicates collision detection between the enemy and the player's shot. SetCollisionB indicates collision detection between the enemy and the player's character.

        if(frame == 10) {
            CreateShot01(GetX, GetY, 5, GetAngleToPlayer, RED01, 0);
            frame = 0;
        }

The enemy fires a bullet toward the player's character per 10 frames.

        frame++;

Increment frame count.


Drawing Loop

        DrawGraphic(GetX, GetY);

Draw the boss graphic. The drawn graphic is indicated on initialization with SetTexture and SetGraphicRect.


Finalization

        DeleteGraphic(ImgBoss);

Delete the boss graphic from the memory. The LoadGraphic-DeleteGraphic pair is required to use graphics.


Also on Fandom

Random Wiki