Moving background in Main Menu Screen?

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
Beckers
Regular
Posts: 30
Joined: Thu May 16, 2013 4:21 am
Contact:

Moving background in Main Menu Screen?

#1 Post by Beckers »

I want to make the main menu of my game have a background that moves.

I'd like it to be a sky, with clouds slowly drifting by. I tried to set the option that changes the bg image to a base of a blue sky, and add an image of clouds on top, translating, but that didn't work.

Can anyone help? What code would make this work, or is it even possible?

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

Re: Moving background in Main Menu Screen?

#2 Post by nyaatrap »

Easy way is remove the background from main menu screen then show in label using ATL instead

Code: Select all

label main_menu:
  scene sky
  show cloud:
    xalign 0.0
    linear 100 xlign 1.0
  show screen main_menu
  $ui.interact
You can do the similar thing in screens, but label is more accurate and flexible.

pwisaguacate
Veteran
Posts: 356
Joined: Mon Mar 11, 2013 11:03 pm
Contact:

Re: Moving background in Main Menu Screen?

#3 Post by pwisaguacate »

@nyaatrap: Could you clarify how to get label main_menu to work correctly? When I try to use it, it glitches and goes onto label start.

In the past, I've defined images with ATL blocks as seen in [link].

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

Re: Moving background in Main Menu Screen?

#4 Post by nyaatrap »

label main_menu is called replacing screen main_menu after label splashscreen. If there's this label, screen main_menu is nullified.
Usage of this label is pretty much same to other any labels. But you need to include a screen which has start action at the last of this label. Usually, just show screen main_menu + $ui.interact should work.

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

Re: Moving background in Main Menu Screen?

#5 Post by xavimat »

I've done that directly in the Main Menu screen, adding before an init block with an ATL image, and with the "add" statement.
This way:

Code: Select all

init:
    image bg fly:   # defining the image with ATL. This one moves left, then right, and loops.
        "bg/fly.png"
        xaling 0.0
        linear 5 xalign 1.0
        linear 5 xalign 0.0
        repeat

screen main_menu:

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

    # The background of the main menu.
    window:
        style "mm_root"
    
    add "bg fly"  ## Adding the moving background

    # The main menu buttons.
    frame:
        style_group "mm"
        xalign .98
        yalign .98

        has vbox

        textbutton _("Start Game") action Start()
        textbutton _("Load Game") action ShowMenu("load")
        textbutton _("Preferences") action ShowMenu("preferences")
        textbutton _("Help") action Help()
        textbutton _("Quit") action Quit(confirm=False)
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
Beckers
Regular
Posts: 30
Joined: Thu May 16, 2013 4:21 am
Contact:

Re: Moving background in Main Menu Screen?

#6 Post by Beckers »

I tried as well and I got

"invalid syntax
label main_menu->:"

Can someone specify how it's supposed to be used? Newb here :(

pwisaguacate
Veteran
Posts: 356
Joined: Mon Mar 11, 2013 11:03 pm
Contact:

Re: Moving background in Main Menu Screen?

#7 Post by pwisaguacate »

I'm not sure how you're getting that error...

I'd go for what xavimat posted. Declare an image with an ATL block (animation code); then add it to the main menu screen. (Set mm_root to the base image in options.rpy.)

User avatar
Beckers
Regular
Posts: 30
Joined: Thu May 16, 2013 4:21 am
Contact:

Re: Moving background in Main Menu Screen?

#8 Post by Beckers »

Thank you so much everyone! I got it to work, for the most part. For some reason I could see the image of my clouds, but they wouldn't transform across the screen. So I ended up just using a slideshow option type thing to create the illusion of movement XD

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

Re: Moving background in Main Menu Screen?

#9 Post by nyaatrap »

BTW, the reason why menu label is recommended is there's an issue on ui.add function. It slows down performance horribly, and some transforms couldn't work correctly.

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: Moving background in Main Menu Screen?

#10 Post by trooper6 »

Hi everyone! I've been working on the opening credits of my VN and sort of came up a bit stumped.

So here is the concept:
The screen is black...music begins...2 seconds pass...the title dissolves into view center...2 seconds pass...then the menu buttons dissolve into view (but the title still is visible).

Okay so I tried to do this a couple different ways.

The first thing I did was make this a main_menu label: (note there is a bit of funniness here with layers, because my master layer is smaller than the game screen.

Code: Select all

label main_menu:
    show black onlayer underlay
    play music "00 sounds/01DanseMacabre.mp3" fadeout 1
    pause 2.0 #pause 1
    show expression Text("THE RECKONING", size=50, yalign=0.5, xalign=0.5) onlayer overlay as text with Dissolve(1)
    pause 2.0 #pause 2
    call screen main_menu
So this didn't do what I wanted. The first thing is that pause 2 doesn't cause the screen to linger on the title for two seconds, instead the screen goes black for 2 seconds and then it brings up the main menu. How can I get the game to pause on the text?

The next issue is that it doesn't add the main_menu screen on top of what was there before, it replaces it. Which isn't actually what I wanted...because the menu disappeared.

I tried using:

Code: Select all

    show screen main_menu
    $ui.interact
But that didn't work either. a) it still replaced the original titles with the menu screen...and b) even worse, it then immediately when to the start of the game rather than waiting for a button to be pressed. So I went back to the call rather than the show.

So that wasn't working. So I created a background image that had the title on it and made that the background of the main_menu. The text expression and the background image weren't completely lined up so it looked a bit weird. So I went with this:

Code: Select all

label main_menu:
    show black onlayer underlay
    play music "00 sounds/01DanseMacabre.mp3" fadeout 1
    pause 2.0 #pause 1
    show bg title onlayer overlay with Dissolve(1)
    pause 2.0 #pause 2
    call screen main_menu
So I showed the bg image with the title and then called the screen main_menu with the same image as its background. That worked...but I still couldn't get the game to pause on the "show bg title onlayer overlay with Dissolve(1)" for 2 seconds, it would immediately go the the main_menu screen. So how can I get it to pause on that show bg title before calling the screen main_menu?

So anyway, what is the best way to achieve the effect that I want? And really, how do I get the thing to pause on the title for two seconds before the main menu comes up?
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
redcat
Regular
Posts: 189
Joined: Thu Oct 30, 2008 9:30 am
Contact:

Re: Moving background in Main Menu Screen?

#11 Post by redcat »

Pause didn't work? how about this :
$ renpy.pause(2.0)
Meowwngg...??

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: Moving background in Main Menu Screen?

#12 Post by trooper6 »

I had originally tried $renpy.pause(2.0).
There is a pause, but it is a pause on a blank black screen, not on the image I want them to see.
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: Google [Bot], IrisColt, Yohru