Page 1 of 1
Moving background in Main Menu Screen?
Posted: Sat May 18, 2013 3:12 am
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?
Re: Moving background in Main Menu Screen?
Posted: Sat May 18, 2013 7:24 am
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.
Re: Moving background in Main Menu Screen?
Posted: Sat May 18, 2013 9:17 am
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].
Re: Moving background in Main Menu Screen?
Posted: Sat May 18, 2013 10:23 am
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.
Re: Moving background in Main Menu Screen?
Posted: Sat May 18, 2013 1:36 pm
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)
Re: Moving background in Main Menu Screen?
Posted: Sun May 19, 2013 11:39 pm
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

Re: Moving background in Main Menu Screen?
Posted: Mon May 20, 2013 12:51 am
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.)
Re: Moving background in Main Menu Screen?
Posted: Mon May 20, 2013 2:51 am
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
Re: Moving background in Main Menu Screen?
Posted: Mon May 20, 2013 7:10 am
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.
Re: Moving background in Main Menu Screen?
Posted: Sun Jun 23, 2013 7:59 pm
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?
Re: Moving background in Main Menu Screen?
Posted: Sun Jun 23, 2013 8:47 pm
by redcat
Pause didn't work? how about this :
$ renpy.pause(2.0)
Re: Moving background in Main Menu Screen?
Posted: Sun Jun 23, 2013 9:07 pm
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.