Ren'Py memo

Ren'Pyの個人的なメモ

LayeredImageのコードを短縮するプラグイン

draida.itch.io

注意

  • Ver.8.00以上、pngとwebpの画像のみ対応
  • 2024/01/28現在、ルートフォルダーに無いimageは使用できない→目パチなどでimageに直接transformを使用するLayeredImageには適さない
  • sprite_imagesのエラーが出る場合、55行目辺りに_sprite_images = []を入れる

内容

画像名・コードがスッキリする。
例:cg1_a_a1.png → cg1/aのフォルダにa1.pngを入れるだけでよくなる。

コード例

短縮前のコード

    layeredimage cg1:
        at zoo1
        always "cg1_base"

        group a:
            attribute a1 default
            attribute a2
            attribute a3
        group b:
            attribute b0 default
            attribute b1
            attribute b3
        group c:
            attribute c1 default
            attribute c2
            attribute c3
        group d:
            attribute d1 default
            attribute d2
            attribute d3
        group e:
            attribute e1 default
        group f:
            attribute f1 default

短縮後のコード

    image cg1 = FolderSprite(
        "images/cg1",
        at = zoo1,
        auto_attributes = True,
        a = "a1",
        b = "b1",
        c = "c1",
        d = "d1",
        e = "e1",
        f = "f1")
フォルダ構造の例