[SOLVED] Leaves falling animation on Main Menu

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
PREZ
Newbie
Posts: 6
Joined: Wed Mar 14, 2018 3:45 pm
Location: Cantabria, Spain
Contact:

[SOLVED] Leaves falling animation on Main Menu

#1 Post by PREZ »

Hello!

I've just started using Ren'Py and I'm trying to customize the main menu page adding some personal illustrations and animations using the framework, but I'm struggling with one animation in particular.

What I want to achieve:
  • Animated leaves falling in different directions and speed. (Achieved)
  • The leaves change in shape and color (as if they were a GIF) in a loop while they're falling. (Not achieved)
So, this is my main menu right now. Leaves are falling.

Image

But I would like the leaves to change in shape and color like this.
test.gif
test.gif (3.14 KiB) Viewed 1181 times
What I have (code):

Code: Select all


image hojas = Fixed(
        SnowBlossom(im.FactorScale("images/particles3.png", 1), 20, xspeed=(20, 50), yspeed=(100, 200), start=50),
        SnowBlossom(im.FactorScale("images/particles3-2.png", 1), 20, xspeed=(10, 25), yspeed=(50, 100), start=50))

screen main_menu:

	add hojas

My problem is that I haven't find the way to use ATL animations with animated images outside or inside SnowBlossom functions. I don't know how to merge this two pieces of code together:

Code: Select all


#Animated leaves that change in shape and color
image animatedpic:
        "assets/image1.png"
        pause 0.2
        "assets/image2.png"
        pause 0.2
        repeat

#Transform that moves the leaves from the top of the window to the bottom.
transform falling1:
        xalign 0.5 yalign -0.3
        linear 10.0 yalign 1.5 xalign 0.2
        repeat        
I've tried using .webm instead of two images with ATL but I don't fully understand how to add movies to the main menu or how to apply transform to them.

Thanks in advance for your help! <3
Last edited by PREZ on Sat Mar 17, 2018 6:49 am, edited 1 time in total.

User avatar
PREZ
Newbie
Posts: 6
Joined: Wed Mar 14, 2018 3:45 pm
Location: Cantabria, Spain
Contact:

Re: [SOLVED] Leaves falling animation on Main Menu

#2 Post by PREZ »

I've been thinking about this all day and trying stuff and I finally have an answer!

Code: Select all

image hojas : 
        Fixed(SnowBlossom(Animation("images/particles3.png", 0.15, "images/particles3-2.png", 0.15)))
        
screen main_menu:
	add hojas
"Animation()" allows me to use several images as if they where a GIF, while SnowBlossom() takes care of the falling animation so... Done!

Thanks anyway :3

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: [SOLVED] Leaves falling animation on Main Menu

#3 Post by Milkymalk »

The solution is so much sweeter if you found it yourself :D Congrats and welcome to the forum!
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
mitoky
Veteran
Posts: 316
Joined: Sat Feb 07, 2015 9:12 pm
Projects: The Purring Demon's Love, circus eterie
Contact:

Re: [SOLVED] Leaves falling animation on Main Menu

#4 Post by mitoky »

Glad that you found a solution (: I only want to add that you can too use already defined things in SnowBlossom etc.

So what too would work is this:

Code: Select all

#here we have the leaves
image animatedleaves =
    "assets/image1.png"
    pause 0.2
    "assets/image2.png"
    pause 0.2
    repeat

#here we have the animation for the title screen. Instead of a file name you add the name of the leave animation, hence "animatedleaves"        
image fallingleaves = Fixed(
    SnowBlossom("animatedleaves", count=50, xspeed=(-120, 120), yspeed=(90, 200), start=10, fast=False, horizontal=False))    
        

User avatar
PREZ
Newbie
Posts: 6
Joined: Wed Mar 14, 2018 3:45 pm
Location: Cantabria, Spain
Contact:

Re: [SOLVED] Leaves falling animation on Main Menu

#5 Post by PREZ »

Noted. Thank you very much, mitoky! <3.

Post Reply

Who is online

Users browsing this forum: Google [Bot], Ocelot