• Welcome to Touhou Wiki!
  • Registering is temporarily disabled. Check in our Discord server to request an account and for assistance of any kind.

Touhou Danmakufu/Syntax/Framework

From Touhou Wiki
Jump to navigation Jump to search

Summary

#TouhouDanmakufu          // This line must be required
#Title[Test Sign "Test"]  // The title of the script
#Text[Test script]        // The description of the script which is shown when selected
#Image[.\img\test.png]    // The path of the image which is shown when selected
#BackGround[User()]       // Information of the background image (optional)
#BGM[.\bgm\test.mp3]      // The path of the background music (optional)
#PlayLevel[Normal]        // Play level (optional)
#Player[REIMU,MARISA]     // Available characters (optional)
#ScriptVersion[2]         // Script version (normally 2)

script_enemy_main {
    @Initialize {
        // Initialization routine.
        // It is executed once at appearing.
    }

    @MainLoop {
        // Main loop.
        // It is executed once per frame, until the enemy is defeated.
    }

    @DrawLoop {
        // Drawing loop.
        // It is executed once per frame after the main loop, until the enemy is defeated.
    }

    @Finalize {
        // Finalization routine.
        // It is executed once at disappearing.
    }

    @BackGround {
        // Background routine.
        // It is optional.
    }
}

#TouhouDanmakufu (required)

This directive describes that this script is single-script mode.

#東方弾幕風

can be also used instead.


#Title (required)

This directive indicates the title of the script as follows:

#Title[Night Sparrow "Midnight Chorus Master"]

#Text (optional but recommended)

This directive indicates the description of the script as follows:

#Text[Chorus Master is synonymous with Conductor.
This is not Mystia's song, but her familiar's.]

The description is shown when selected.

#Image (optional but recommended)

This directive indicates the path of the script image as follows:

#Image[.\img\midnight_chorus_master.png]

The image is shown when selected.

"." at the head of the path describes the folder which contains this script.

#BackGround (optional)

This directive indicates the information of the background image as follows:

#BackGround[Default]
#BackGround[User(.\img\background.png, 1, 1)]

If there is a @Background block, this directive is ignored.

  • Default

    Default background
  • IceMountain

    Background like ice mountains
  • User(path, x, y)

    path: Path of the background image
    x: X-coordinate velocity
    y: Y-coordinate velocity
    All the parameters are optional. If all the parameters are omitted, the background turns black.

#BGM (optional)

This directive indicates the path of the background music as follows:

#BGM[.\bgm\deaf_to_all_but_the_song.mp3]

WAVE, MP3, and Ogg Vorbis formats are available.

If this directive is omitted, (Touhou Danmakufu Folder)\bgm\bgm.wav is used.

#PlayLevel (optional)

This directive indicates the play level as follows:

#PlayLevel[Normal]

#Player (optional)

This directive indicates the available characters as follows:

#Player[REIMU,MARISA,.\sakuya\sakuya_a.txt,.\sakuya\sakuya_b.txt]

The following options are enumerated in the brace:

  • REIMU

    Reimu Hakurei can be used.
  • MARISA

    Marisa Kirisame can be used.
  • path

    Path of a user-defined character script. User-defined character scripts is located at (Touhou Danmakufu Folder)\player.
  • FREE

    All the characters can be used; REIMU, MARISA, and all the user-defined characters.

This directive was introduced in version 0.12.

#ScriptVersion (practically required)

This directive indicates the script version as follows:

#ScriptVersion[2]

Normally 2 is indicated. Version 1 is very very old.

script_enemy_main

All the behavior of the enemy is described in this block. This block contains variables and routines.

There are some special routines; @Initialize, @MainLoop, @DrawLoop, @Finalize, and @BackGround.

@Initialize (practically required)

Initialization routine. It is executed once when the enemy appears.

@MainLoop (practically required)

Main loop. It is executed once per frame, until the enemy is defeated.

@DrawLoop (practically required)

Drawing loop. It is executed once per frame after the main loop, until the enemy is defeated. The graphics drawn in this routine is drawn under all the characters and bullets.

@Finalize (practically required)

Finalization routine. It is executed once when the enemy disappears.

@BackGround (optional)

Background routine. It is executed once per frame before the drawing loop, until the enemy is defeated. The graphics drawn in this routine is drawn under all the characters, bullets, and graphics drawn in drawing loop.