Trouble with main menu video background & button positioning

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
Creezd
Newbie
Posts: 2
Joined: Sun Jan 14, 2018 3:10 pm
Contact:

Trouble with main menu video background & button positioning

#1 Post by Creezd »

First of all I'd like to say thanks in advance for any help that you can give me. I have read the new UI documentation and have been able to figure out most things I wanted to do, but have had trouble with these two things.

Problem 1: Main menu video background

I am trying to use an .avi as my main menu background (Behind the text and buttons). The first thing I tried was simply replacing the default png background like this, but it didn't work for obvious reasons:

Code: Select all

define gui.main_menu_background = "images/video/mm.avi"
I then did a bit of research and found this code which I put just below screen main_menu():. The problem is that this causes a a blank alpha main menu with no buttons or text. I'm thinking this will work but I must be doing something wrong.

Code: Select all

screen main_menu():

    tag menu

    add Movie(size=(1920, 1080))
    on "show" action Play("movie", "images/video/mm.avi", loop=True)
    on "hide" action Stop("movie")
    on "replace" action Play("movie", "images/video/mm.avi", loop=True)
    on "replaced" action Stop("movie")
Problem 2: Main menu button positioning

I would like to have the main menu buttons on the bottom of the screen going from left to right. In the old UI I did this by doing an imagemap, but this doesn't seem to be possible anymore. I've figured out how to move the buttons on the menu as a group, but not how to change their orientation individually.
SteamWorks developer currently working on a sci-fi visual novel.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3792
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Trouble with main menu video background & button positioning

#2 Post by Imperf3kt »

https://www.renpy.org/doc/html/movie.html
Should fix issue #1
Check:
- Your AVI uses a supported codec
- You can change the menu bg to a video with:
Add the following anywhere outside a label. If you're unsure, place it in an init block

Code: Select all

image main_menu = Movie(channel="main_menu", play="main_menu.avi")
Then find the screen called 'main menu' and add

Code: Select all

    add "main_menu"
I believe this does not (and there's no work-around except ATL) work on Android.


Issue #2:
To position the buttons horizontally using the latest GUI, you'll need to do a reasonably significant adjustment to some screens.

Go to the main menu screen and remove the line that says "use game_menu"

Now you may use your imagemap method, or the more recommended (and in my opinion, better) imagebuttons inside a hbox or other container.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
Creezd
Newbie
Posts: 2
Joined: Sun Jan 14, 2018 3:10 pm
Contact:

Re: Trouble with main menu video background & button positioning

#3 Post by Creezd »

Imperf3kt wrote: Sun Jan 14, 2018 4:47 pm --
This is great stuff! I've already gotten started on the imagebuttons and I don't think that's going to be an issue, and I was able to get the video background working after converting the .avi to a .webm with a compatible codec.

Thanks for your help Imperf3kt. I really appreciate it :)
SteamWorks developer currently working on a sci-fi visual novel.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]