Animated mainmenu background: how to do it?

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.
Message
Author
User avatar
zankizuna
Veteran
Posts: 416
Joined: Fri May 04, 2012 2:20 am
Completed: Monochrome Valentine
Projects: Softwar
Deviantart: raseru09
itch: ZanKizuna
Location: Manilaaaaaaaa
Contact:

Animated mainmenu background: how to do it?

#1 Post by zankizuna »

How am I supposed to place an animated background pic in the main menu?
I've tried doing some codes around "mm_root=" but I just can't get it right..
I've tried making a video to use then place it there, but it didn't work... what is the proper code?

SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Animated mainmenu background: how to do it?

#2 Post by SundownKid »

You should leave mm_root blank and add the animated image directly to the screen code in the screens script. I don't think a video would work, though it would be useful to me if someone had a way to use it as a background.

User avatar
Fade Lalique
Newbie
Posts: 11
Joined: Sun May 27, 2012 6:06 am
Contact:

Re: Animated mainmenu background: how to do it?

#3 Post by Fade Lalique »

I think it would be possible to convert the video you plan to use into a gif file. That way it might work

User avatar
Hijiri
Eileen-Class Veteran
Posts: 1519
Joined: Sun Mar 25, 2012 6:35 pm
Completed: Death Rule:lost code Overdrive Edition, Where the White Doves Rest-Tsumihanseishi
Projects: Death Rule: Killing System
Organization: MESI Games
IRC Nick: Hizi
Tumblr: mesigames
Skype: kurotezuka
itch: hijiri
Location: Los Angeles
Contact:

Re: Animated mainmenu background: how to do it?

#4 Post by Hijiri »

Fade Lalique wrote:I think it would be possible to convert the video you plan to use into a gif file. That way it might work
Renp dosent support Gif files (Well, animated ones at least) you'll have to anomate via ATL code
Image Image
"Perfection goal that always changes. Can pursue, cannot obtain."

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: Animated mainmenu background: how to do it?

#5 Post by nyaatrap »

hm, if I remember correctly, the screen language doesn't support the repeat statement of ATL, does it? I think I read it somewhere in the forum...

User avatar
rinrin
Veteran
Posts: 211
Joined: Thu Apr 16, 2009 9:18 am
Completed: Several.
Projects: Several.
Contact:

Re: Animated mainmenu background: how to do it?

#6 Post by rinrin »

I think this should work:

Code: Select all

##############################################################################
# Main Menu 
#
# Screen that's used to display the main menu, when Ren'Py first starts
# http://www.renpy.org/doc/html/screen_special.html#main-menu

screen main_menu:

    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        xpadding 0
        ypadding 0
        add "youranimatedbgpic"
youranimatedbgpic is defined where your other images are defined - ATL's repeat statement should work normally.

For example:

Code: Select all

    image youranimatedbgpic:
        "assets/rotating-image.png"
        xanchor 0.5
        yanchor 0.5
        rotate 0
        linear 50.0 rotate 360
        repeat

TrickWithAKnife
Eileen-Class Veteran
Posts: 1261
Joined: Fri Mar 16, 2012 11:38 am
Projects: Rika
Organization: Solo (for now)
IRC Nick: Trick
Location: Tokyo, Japan
Contact:

Re: Animated mainmenu background: how to do it?

#7 Post by TrickWithAKnife »

I think what the original poster was looking for was a method of showing an animation using either a .gif with different frames, or cycling through different images.

nyaatrap wrote:hm, if I remember correctly, the screen language doesn't support the repeat statement of ATL, does it? I think I read it somewhere in the forum...
I'm only guessing, because I'm not having much luck getting ATL code to work, but if you can use ATL to create an animation, maybe it would be possible to place the animation in a label, and then loop the label itself.
"We must teach them through the tools with which they are comfortable."
The #renpy IRC channel is a great place to chat with other devs. Due to the nature of IRC and timezone differences, people probably won't reply right away.

If you'd like to view or use any code from my VN PM me. All code is freely available without restriction, but also without warranty or (much) support.

User avatar
rinrin
Veteran
Posts: 211
Joined: Thu Apr 16, 2009 9:18 am
Completed: Several.
Projects: Several.
Contact:

Re: Animated mainmenu background: how to do it?

#8 Post by rinrin »

TrickWithAKnife wrote:I think what the original poster was looking for was a method of showing an animation using either a .gif with different frames, or cycling through different images.
The principle is the same. Only this part changes:

Code: Select all

    image youranimatedbgpic:
        "assets/image1.png"
        pause 0.1
        "assets/image2.png"
        pause 0.1
        "assets/image3.png"
        pause 0.1
        repeat
No problems with repeat, it works just fine on the title screen. Or is title screen not what we're talking about?

User avatar
zankizuna
Veteran
Posts: 416
Joined: Fri May 04, 2012 2:20 am
Completed: Monochrome Valentine
Projects: Softwar
Deviantart: raseru09
itch: ZanKizuna
Location: Manilaaaaaaaa
Contact:

Re: Animated mainmenu background: how to do it?

#9 Post by zankizuna »

Thanks a lot guys I think rinrin got the code right..
GIFs are not supported by ren'py.. I've known this ever since.
I really needed a code like that. thanks.

BlackRose4eva
Newbie
Posts: 22
Joined: Wed Jul 08, 2015 6:34 am
Contact:

Re: Animated mainmenu background: how to do it?

#10 Post by BlackRose4eva »

I've also wanted to do this too and I've been looking at various threads in order to achieve this.

Below is my code at the moment that I tried placing in the script.rpy and screen.rpy (at different times) but it has had no effect. My main aim is to cycle through some images which place the main menu one bit at a time until it's completed and then things go as normal.

Code: Select all

image animated_main_menu:
    "images/GUI/main_menu_plain.png"
    pause 1.0
    "images/GUI/main_menu_1.png"
    pause 1.0
    "images/GUI/main_menu_2.png"
    pause 1.0
    "images/GUI/main_menu_3.png"
    pause 1.0
    "images/GUI/main_menu_4.png"
    pause 1.0
    "images/GUI/main_menu_5.png"
    pause 1.0
I am not quite sure what is going wrong here so any advice would be highly appreciated. I have tried things like

Code: Select all

label before_main_menu:
and placing this code after it but that didn't seem to work either

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Animated mainmenu background: how to do it?

#11 Post by trooper6 »

Have you added your image to the main menu screen?
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

BlackRose4eva
Newbie
Posts: 22
Joined: Wed Jul 08, 2015 6:34 am
Contact:

Re: Animated mainmenu background: how to do it?

#12 Post by BlackRose4eva »

I have added the main image for my main menu screen in the options.rpy as

Code: Select all

mm_root = "images/GUI/main_menu_small2.png"
so it isn't part of my animation because it is the same as another on of my files within the animation that I want to do ("images/GUI/main_menu_5.png")

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Animated mainmenu background: how to do it?

#13 Post by trooper6 »

This quote by rinrin is how to create an animated image using ATL and then show it on your main menu, which is done by adding it to the main menu screen.
rinrin wrote:I think this should work:

Code: Select all

##############################################################################
# Main Menu 
#
# Screen that's used to display the main menu, when Ren'Py first starts
# http://www.renpy.org/doc/html/screen_special.html#main-menu

screen main_menu:

    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        xpadding 0
        ypadding 0
        add "youranimatedbgpic"
youranimatedbgpic is defined where your other images are defined - ATL's repeat statement should work normally.

For example:

Code: Select all

    image youranimatedbgpic:
        "assets/rotating-image.png"
        xanchor 0.5
        yanchor 0.5
        rotate 0
        linear 50.0 rotate 360
        repeat
If you have done this and you get no effect it is probably because your basic main menu root image is the final end state of what you want the menu to look like, so the animation isn't visible as it is just placing images over images that are already there in the base image. Try changing your base image to solid black (or whatever your base color is).
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

BlackRose4eva
Newbie
Posts: 22
Joined: Wed Jul 08, 2015 6:34 am
Contact:

Re: Animated mainmenu background: how to do it?

#14 Post by BlackRose4eva »

I actually have read that one before posting here and I tried implementing it but it didn't work for me for some reason (although, since I am a real noob, it's probably something stupidly simple I'm screwing up here)

I placed

Code: Select all

image animated_main_menu:
        "images/GUI/main_menu_plain.png"
        pause 1.0
        "images/GUI/main_menu_1.png"
        pause 1.0
        "images/GUI/main_menu_2.png"
        pause 1.0
        "images/GUI/main_menu_3.png"
        pause 1.0
        "images/GUI/main_menu_4.png"
        pause 1.0
        "images/GUI/main_menu_5.png"
in the script.rpy file since that is where most images are declared (I assumed) and

Code: Select all

screen main_menu():

    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        xpadding 0
        ypadding 0 
        add "animated_main_menu"
        
in screens.rpy

Right now, it's just showing my main title screen without the animation effect.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Animated mainmenu background: how to do it?

#15 Post by trooper6 »

As I said in my last post, I suspect this is because you made your mm_root an image that is the same as what the animation looks like when it is finished. If all the parts are already being shown and the animation puts those parts up on top of the parts that are already there in the base image, you aren't going to see the animation even if it is working. As I suggested in my last post, make your mm_root a plain black screen (or whatever your base image is).
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: Amazon [Bot]