Displaying Images After Choices

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
DiamondDust132
Newbie
Posts: 20
Joined: Thu Sep 28, 2017 2:38 am
Organization: Team Requiem
itch: team-requiem
Location: Georgia
Contact:

Displaying Images After Choices

#1 Post by DiamondDust132 »

Hello. I'm going to try to explain this the best I can. What I want to happen is an image to briefly pop up whenever the player picks a certain choice on the choice menu. Say for instance, the player picks a choice that leads them on the route of 'GirlA'. I'd want a small picture of 'GirlA' to briefly flash on the screen so the player realizes they're on the right track. I've seen this done in other Ren'Py visual novels, so I know it's possible. I just have no clue where to even begin trying to implement this. Any help would be greatly appreciated.

User avatar
RicharDann
Veteran
Posts: 286
Joined: Thu Aug 31, 2017 11:47 am
Contact:

Re: Displaying Images After Choices

#2 Post by RicharDann »

Do you want the image to quickly flash when the player hovers on the choice, or after the player already picked the choice?
Either way you could make a transform that shows the image and hides it after a short time, depending on wich way you want to show it you would need to use different code. Here's an example, it's rather crude but it could be a start:

Code: Select all

image girlA = "girlA.png"

image girlB = "girlB.png"

transform glimpse:
    align (.5,.3)
    linear .2 alpha 0
    
# Or, you can use a screen, the effect seems to be the same:

screen showGlimpse(img):
    
    modal True
    
    add img at Position(xalign=.5,yalign=.3) 
    
    timer 0.2 action Hide('showGlimpse') #Hide the screen after half second passes


# The game starts here.

label start:

    menu:
        "Where should I go?"
        
        "Option 1.": #Girl A's route
            
            show girlA at glimpse
            
            "Let's go with 1."
            
        "Option 2.": #Girl B's route
            
            show girlB at glimpse
            
            "I choose 2."
Last edited by RicharDann on Wed Oct 11, 2017 3:39 pm, edited 3 times in total.
The most important step is always the next one.

User avatar
DiamondDust132
Newbie
Posts: 20
Joined: Thu Sep 28, 2017 2:38 am
Organization: Team Requiem
itch: team-requiem
Location: Georgia
Contact:

Re: Displaying Images After Choices

#3 Post by DiamondDust132 »

Ah! Perfect! That did the trick. Thank you so much!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], voluorem