Skip to content
Advertisement

How do I make a menu screen using Ursina Python?

Usually I would make a function or an if statement, like this:

JavaScript

or something like:

JavaScript

The latter needs a global variable with a class, which is fine for me. However in Ursina, none of these work, either the update function stops on the former, or the color.red, color.blue, etc. stops working out of nowhere, or the second if statement just doesn’t run. Does anyone have an alternative? I’m thinking of just making a home_screen.py file entirely but that won’t do much good, and I’m not sure how that can be implemented anyway.

Edit: while loops also don’t seem to work

Advertisement

Answer

Making a functional game menu is actually not that simple.

You could make a function that loads all the game models from a level, a function that shows a menu, and a final one that shows a loading screen.

Load a level :

JavaScript

Show the menu :

JavaScript

Show the loading screen :

JavaScript

Rest of the file :

JavaScript

Edit : a basic example is available here.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement