Making "animated" main menu backgrounds? [SOLVED]

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
Rainbow Colors
Regular
Posts: 78
Joined: Tue Apr 16, 2013 11:12 pm
Projects: Come Here Often?
Contact:

Making "animated" main menu backgrounds? [SOLVED]

#1 Post by Rainbow Colors »

Hello, I'm trying to make a main menu background that's animated - but not with a video. I have already tried doing one where there's only one image that "infinitely scrolls [diagonally]".

This time though, I'm trying to make something that has multiple images.

Code: Select all

image mmenu:
    "images/background.png"
    xanchor 0
    yanchor 0
    block:
        "images/ba.png"
        xpos 100
        ypos 100
        linear 2.0 alpha 1.0
        linear 2.0 alpha 0.0
        repeat
    block:
        "images/y.png"
        xpos 200
        ypos 100
        linear 2.0 alpha 1.0
        linear 2.0 alpha 0.0
        repeat
    block:
        "images/ba.png"
        xpos 300
        ypos 100
        linear 2.0 alpha 1.0
        linear 2.0 alpha 0.0
        repeat
    block:
        "images/ye.png"
        xpos 400
        ypos 100
        linear 2.0 alpha 1.0
        linear 2.0 alpha 0.0
        repeat
    block:
        "images/n.png"
        xpos 500
        ypos 100
        linear 2.0 alpha 1.0
        linear 2.0 alpha 0.0
        repeat

define gui.main_menu_background = "mmenu"
Something like that. The idea is to have a static background image, with the title sort of fading in and out. The only thing that shows up in the main menu after using the code above is the first block with ba.png(but the animation works for it, so there's that, ha).

I suspect the problem is with the usage of blocks (because I'm not too sure about them), if the problems isn't about being unable to use multiple images in... one image? It would be fantastic if anyone can tell me about possible tweaks, if not alternatives for making this. Thank you!
Last edited by Rainbow Colors on Thu May 25, 2017 11:41 am, edited 1 time in total.

~targetting every otome game at the speed of sound
(because if I did it at the speed of light, I'd be time travelling)

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: Making "animated" main menu backgrounds?

#2 Post by trooper6 »

Do you want these to be 5 separate images that are all on the screen at the same time and all fade in and out? Or do you want image 1 to fade in and out, then image 2 to fade in and out, then image 3 to fade in and out, then image 4 to fade in and out, then image 5 to fade in and out, then image 1 to fade in and out, etc?
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

User avatar
xavimat
Eileen-Class Veteran
Posts: 1460
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love, unknown
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Contact:

Re: Making "animated" main menu backgrounds?

#3 Post by xavimat »

I would change the main_menu screen directly, instead of using define gui.main_menu_background = "mmenu"
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
Rainbow Colors
Regular
Posts: 78
Joined: Tue Apr 16, 2013 11:12 pm
Projects: Come Here Often?
Contact:

Re: Making "animated" main menu backgrounds?

#4 Post by Rainbow Colors »

trooper6 wrote:Do you want these to be 5 separate images that are all on the screen at the same time and all fade in and out? Or do you want image 1 to fade in and out, then image 2 to fade in and out, then image 3 to fade in and out, then image 4 to fade in and out, then image 5 to fade in and out, then image 1 to fade in and out, etc?
The former.
xavimat wrote:I would change the main_menu screen directly, instead of using define gui.main_menu_background = "mmenu"
I'll try that, then, thank you.

~targetting every otome game at the speed of sound
(because if I did it at the speed of light, I'd be time travelling)

User avatar
Rainbow Colors
Regular
Posts: 78
Joined: Tue Apr 16, 2013 11:12 pm
Projects: Come Here Often?
Contact:

Re: Making "animated" main menu backgrounds?

#5 Post by Rainbow Colors »

Hey, thank you once again for the suggestion. I think I managed to work something out, although I'm not quite sure about its efficiency or something (but hey, if it works, then that's that :D)

Code: Select all

transform pls_transform:
    linear 2.0 alpha 1.0
    linear 2.0 alpha 0.25
    repeat

screen main_menu():
    tag menu

    style_prefix "main_menu"

    add gui.main_menu_background
    add "images/ba.png" xpos 150 ypos 50 at pls_transform
    add "images/y.png" xpos 300 ypos 100 at pls_transform
    add "images/ba.png" xpos 450 ypos 50 at pls_transform
    add "images/ye.png" xpos 600 ypos 100 at pls_transform
    add "images/n.png" xpos 750 ypos 50 at pls_transform
The title symbols fade in and out quite nicely, too.

~targetting every otome game at the speed of sound
(because if I did it at the speed of light, I'd be time travelling)

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: Making "animated" main menu backgrounds? [SOLVED]

#6 Post by trooper6 »

That's the way to do it!

My undergrad compsci teacher once said: if you find yourself writing the same code more than three times, there is a more efficient way of doing what you are doing.
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: Ahrefs [Bot], Google [Bot]