
用意するもの

・雪の結晶の画像x2
私はICOOON MONOさんから2つアイコンを借り、色を明るめに変えて13x15と10x11くらいに縮小しました(私のゲームの解像度は1080x1920)お好みで大きくしたり小さくしたりしてください。これはimagesフォルダに加えておきます。雪じゃなくても色んなもの降らせたらいいと思います。
1.transformコードを貼る
# sauce: https://github.com/Thediamondcryst/Ren-Py-Free-to-Use-Falling-Leaves transform featherspin: alpha 0.5 xpos 0.5 ypos 0.5 choice: zoom 2.0 choice: zoom 1.4 choice: zoom 1.2 choice: zoom 1.0 choice: zoom 0.8 choice: zoom 0.6 linear 3 rotate 360 # 360度回転するのに1秒かける rotate 0 # 位置をリセット repeat
元のコードにchoiceはありませんが、雪の大小のランダム性を増やすために書き加えました。
2.imageコードを貼る
image leaves_blowing = Fixed(
SnowBlossom(At("images/g3.png", featherspin), border=10, count=70, xspeed=(600, 20),horizontal=True),
SnowBlossom(At("images/g4.png", featherspin), border=10, count=70, xspeed=(600, 20),horizontal=True),
)
transformのすぐ下に書いて大丈夫です。
Ren'Py内にあるSnowBlossomという機能を使用しています。
border以降の数値を好きにいじって好きな降らせ方にしてみて下さい。
資料:https://ja.renpy.org/doc/html/sprites.html#SnowBlossom
2. screenに雪を追加する
screen main_menu():
tag menu
style_prefix "main_menu"
add gui.main_menu_background
add "leaves_blowing"
タイトル画面にはadd "leaves_blowing"と追加します。
背景(background)より後にaddしましょう。
余談
label op:
show leaves_blowing
"{――}時{r1}とき{/r1}は{r2}十二月{/r2}{r1}じゅうにがつ{/r1}の{r2}某日{/r2}{r1}ぼうじつ{/r1}。"
show leaves_blowingでlabel内の本編でも追加することができます。
hideで消えます。