The interface (and the camera trick)
The game has a main screen showing the game itself, but also has a starting screen with a button to start the game, a pause menu (esc) with two buttons (resume & restart) and a game over screen.
Armory has a tool called Canvas Editor to build interfaces with text, buttons and other things. Honestly, I don’t think it’s easy to use. So I preferred to make my own system for the interface (but I used the Canvas system to display the score).
I imported some images that represent the buttons with “import images as planes” and add logic nodes to manage them.
Menus are Emptys with child buttons
They are not spawned at start
They are spawned on Events when needed.
When a menu is spawned, the property “is_in_menu” is set to true, to inform other elements that the game is paused.
Then the logic of different elements is paused with the “Pause Trait” node.
When the game is in a menu, main game elements are hidden, except the background Ico Sphere.
To do that, I add a trait to elements that has to be hidden, watching the property “is_in_menu”
To check if a button is clicked, I use the “Pick Object” node.
But … and here is the camera trick :
the “Pick Object” node works well only with a perspective camera. Initially, I used an orthographic camera, as I want the game to have no perspective. I wanted it look flat. So to render flat objects, a perspective camera has to be really far from the object and have a big focal length
By the way, I used the canvas tool to display the score and the level. I never hide these information, they are always visible.
When a button is clicked, a global Event is send to the main game logic, the menu object is removed, the logic is resumed. Here is the whole thing (may be a bit hard to understand at first)
The name of the button is used to know what Event has to be send.
In this case, the Event “continue_game” is sent to the main game logic.
The node “Split String” is very useful to extract information stored in the name of an object. It’s an alternative of object property. A good trick.
Well… I think all is said, please ask if you want more details.
PS : I see that @timodriaan has done a new interface tool that looks cool, here is it : https://koui.gitlab.io/
so, @timodriaan, could you create a topic on the forum, and add an example blend using your library ?