Defold doesn't provide standard functions to implement complex navigation between game screens. The provided examples only show the general idea of switching screens with collection proxies, but your game usually has more than just two screens. So I came up with a plan to develop a reusable navigation solution. I took the inspiration from UINavigationContoller in iOS and React/Redux. My library was the first of its kind, but now other solutions also exist, e.g. Monarch.
- Three different ways to navigate between screens:
- State machine approach to navigation (which, I believe, suits games perfectly);
- Navigation stack (with two variants of pushing the scene to the stack);
- Synchronous or asynchronous loading of collections.
- Support for animated screen transitions.
- Support for "Loading..." screen.
The demo project provides code samples for all possible Router use cases.
Read the documentation on GitHub project page.