I have the main menu with various text buttons, like Start Game, Settings, etc.
I want the game to begin with the 'Start Game' focused, so if they press DOWN on keyboard or controller, it goes to the next button in the list. Currently, none of the buttons is focused and if I press DOWN it hovers/focuses a button to the right that I set keyboard_focus to None (so it shouldn't be selected at all, but it's not working).
I discovered default_focus and tried using this, but it breaks the whole handling. Firstly, the hovered/unhovered functions do not run. Secondly, the keyboard stops working altogether once the mouse unhovers over any button.
It seems to only work properly when I don't use default_focus or keyboard_focus or even focus.
How do I define controller focus order without breaking hovered/unhovered functions for each of the buttons?
Edit: Solved
I figured it out. I just had to define the buttons in the order in which they appear on the screen. I had a button on the right side of the screen that I do not want keyboard/controller to focus, and I had defined it before the other buttons in the screen, so it was the first button being targeted when I pressed 'down' on keyboard or controller. Moving the button definition to the end of the screen solved the problem.
Tbh it's not user-friendly nor intuitive if I set keyboard_focus to None on a button and it is still targeted by keyboard, no matter where in the code I put that button so this might be a bug with the engine. Just keep it in mind in case it happens to you.
(Solved) Keyboard / Controller Default Focus doesn't run Hovered/Unhovered
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.
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.
- SypherZent
- Veteran
- Posts: 331
- Joined: Fri Sep 02, 2016 3:14 am
- Completed: Multiverse Heroes, Space Hamster in Turmoil
- Soundcloud: Chrysopoeist
- Location: Puerto Rico
- Contact:
Who is online
Users browsing this forum: Bing [Bot], Google [Bot]