Drop down HUD

Chatterbox

Active Member
Game Developer
May 28, 2018
560
3,544
Does anyone know how to make a drop down menu work in Ren'py?

Here's what I'm doing. I have a calendar and a stats button. Both are added in the game script files as:

Window show
Show screen stats_button

Here is the code, although I've really only added the images so far.

screen calendar() tag calendar:

modal False

imagebutton:
idle "cal_icon" xalign 0.975 yalign 0.03 action NullAction()
text day_calendar xalign 0.965 yalign 0.06 size 50 color "#000000"

screen stats_button() tag statsbutton:

modal False

imagebutton:
idle "stats_button" hover "stats_button_hover" xalign 0.975 yalign 0.15 focus_mask True action ShowMenu("points_hud")

screen points_hud() tag pointshud:

modal False

imagebutton:
idle "points_hud" hover "points_hud_hover" xalign 0.975 yalign 0.55 focus_mask True action ShowMenu("stats_lexi")
text "[love_stats_lexi]" xalign 0.975 yalign 0.25 size 20 color "#ffffff"

imagebutton:
idle "stats_button" hover "stats_button_hover" xalign 0.975 yalign 0.15 focus_mask True action ShowMenu("stats_button")

What I'm trying to do with this is I have a stats button on the screen, and that works fine. When I click on it, it should show a stats display (points_hud), which it does. Then I want to be able to click on the stats button again to hide the display(points_hud). I have two problems:

1. It pauses the game. The dialog screen disappears and the player can't move the game forward until I hit the left mouse button to go back.

2. Clicking the Stats Button again does not hide the Points Hud.

Any idea what I've got wrong here?

Thanks,
Chatterbox
 

Rich

Old Fart
Modder
Donor
Respected User
Game Developer
Jun 25, 2017
2,565
7,378
For future reference, please put your code inside "code" tags when posting it. Indentation is important in Ren'py - this way it won't get lost.
 
  • Like
Reactions: Chatterbox