Page 1 of 1

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

Posted: Sat Apr 06, 2019 5:35 pm
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 :)

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

Posted: Sat Apr 06, 2019 7:38 pm
by Alex

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

Posted: Sat Apr 06, 2019 8:15 pm
by sasquatchii
That totally worked!! Thank you!!!!