Creating a Keybound "Action Show" Function in the Screens Menu? [SOLVED]

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
sasquatchii
Miko-Class Veteran
Posts: 552
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Creating a Keybound "Action Show" Function in the Screens Menu? [SOLVED]

#1 Post by sasquatchii »

Hello!

I am currently working on coding my game, and have a stats screen where players can look at how much money they have, along with the time of day. I'd like to tuck this part of the menu away - and here's what it currently looks like idle/unhovered:

Image

And here's what it looks like when hovered over and it reveals the amount of money the player has at the top right:

Image

I was wondering if, along with hovering, it would be possible to have this stat appear/disappear if they pressed the "1" button on their keyboard?

Here's what the code for my screen currently looks like:

Code: Select all

screen player_stats():
    zorder 100
    
    imagemap:

            ground "gui/money-amount-idle.png" 
            hover "gui/money-amount-hover.png"
            

            hotspot (1621, 33, 300, 67) action Show("cash_amount") hovered ShowTransient("cash_amount") unhovered Hide("cash_amount") 
            
screen cash_amount():
    zorder 100
    hbox:
        xalign 0.965 yalign 0.0422
        text "{size=28} {color=#ffffff}    Cash: $[Cash]{/size}{/color}" 
        if Cash < 0:
            $ Cash = 0
            
            
Any ideas / help is much appreciated! Thank you for reading :)
Last edited by sasquatchii on Sat Apr 06, 2019 8:14 pm, edited 1 time in total.
ImageImage


User avatar
sasquatchii
Miko-Class Veteran
Posts: 552
Joined: Fri Jul 04, 2014 7:48 am
Completed: A Day in the Life of a Slice of Bread
Deviantart: sasquatchix
Soundcloud: sasquatchii
itch: sasquatchii
Location: South Carolina
Contact:

Re: Creating a Keybound "Action Show" Function in the Screens Menu?

#3 Post by sasquatchii »

That totally worked!! Thank you!!!!
ImageImage

Post Reply

Who is online

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