[SOLVED] Adding displayables to 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
Izzy
Newbie
Posts: 5
Joined: Mon Apr 16, 2018 9:45 pm
Contact:

[SOLVED] Adding displayables to main menu screen

#1 Post by Izzy »

Hello,

I'm relatively new to Ren'Py, but I have a little bit of experience in javascript and python. Anyway, I was wondering how I can add a picture to the main menu screen (not the static background image you can configure in screens.rpy). I want to add a picture to the foreground, not just the background, much like how you can call an image in-game in the script.rpy using the show or image command. I also want to be able to have the pictures transition into the main menu as you open the game using a transform/transition (just like Doki Doki Literature Club!)--I already have the code for the image transformation, I just need to know how to apply it to the main menu screen.

I've been looking around online for help but to no avail. Any help would be very much appreciated. Thank you so much!
Last edited by Izzy on Tue Apr 17, 2018 4:29 am, edited 2 times in total.

User avatar
Qlara
Regular
Posts: 80
Joined: Fri Nov 28, 2014 10:22 am
Completed: Carmilla
Skype: kantonija
itch: visualgothic
Location: Berlin
Contact:

Re: Adding displayables to main menu screen

#2 Post by Qlara »

You can add images with

Code: Select all

    add "images/your_image.png"
just below

Code: Select all

    add gui.main_menu_background
in the screens file under screen main_menu (assuming you are still using this).
For the transition check out your options file. There's a section where transitions are defined, you could try playing with that.

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

Re: Adding displayables to main menu screen

#3 Post by Imperf3kt »

For a menu like the one in DDLC, you'll want to look into the before_main_menu label documented in the documentation.
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
Izzy
Newbie
Posts: 5
Joined: Mon Apr 16, 2018 9:45 pm
Contact:

Re: Adding displayables to main menu screen

#4 Post by Izzy »

Hey Qlara,

Thank you for your response, now I know how to add images to the main menu! :D

There is one more problem, however. I've defined a transformation, fly:

transform fly(x):
zoom x * 0.5
parallel:
ease 1.5 zoom x

And this is what I'm trying to do in screens.rpy, under 'add gui.main_menu_background':

add "images/izzymenu.png":
fly(0.5)


I'm trying to apply a transformation to the image, but I'm not sure where to place the code that defines the transformation. I've tried putting it in all of the rpy files, including screens.rpy. When I try to apply the transformation to the image, I only get a syntax error when I start my game.

Again, thank you for all your help!

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: Adding displayables to main menu screen

#5 Post by kivik »

To apply a transform you need to use the keyword "at"

So try this:

Code: Select all

add "images/izzymenu.png" at fly(0.5)
Syntax error basically means the code you put in doesn't conform to the language's format, and usually references which line the syntax error is (I think). In this instance - providing you've done the indentation right, your transform can live in any file.

User avatar
Izzy
Newbie
Posts: 5
Joined: Mon Apr 16, 2018 9:45 pm
Contact:

[SOLVED] Adding displayables to main menu screen

#6 Post by Izzy »

kivik wrote: Tue Apr 17, 2018 4:15 am To apply a transform you need to use the keyword "at"

So try this:

Code: Select all

add "images/izzymenu.png" at fly(0.5)
Syntax error basically means the code you put in doesn't conform to the language's format, and usually references which line the syntax error is (I think). In this instance - providing you've done the indentation right, your transform can live in any file.
Aaaaah!! I just realized my mistake. Thank you so much for your help! :D

Post Reply

Who is online

Users browsing this forum: Google [Bot]