MM_Preloader lets you load assets into memory at any time you choose. You can preload next layout's assets just before you go to next layout, this way the engine itself will not have to do it at start of layout 2 which means there will be no lag.
It may sound a bit complex but with MM_Preloader it is extremely easy.
Let's go through this example:
Add all objects from layout Layout 2 - This action scans Layout 2 and adds any preloadable objects it finds to the preloader's list. Preloadable objects are all objects that use images like Sprite, Tilemap, SpriteFont, SpriteFont+, TiledBackground, etc. (even Spriter objects).
Note that it's also possible to pick the layout by name (string) or add individual objects.
Start - Starts preloading objets which are added to the list.
Then we make Progress layer visible because in this example we put text with preloading progress % on this layer.
On progress - This condition triggers any time there's a progress in preloading. Current state of preloading can be fetch by MM_Preloader.Progress expression. Note that it's also possible to the progress of particular item.
On completed - Triggers when all objects are preloaded.
To me the ability to preload layouts and make real layout preloaders with progress bar is the most exciting feature of MM_Preloader, but that's not all what this plugin can do.
With MM_Preloader it is possible to:
- Make initial LayoutLoader much easier than with native C2,
- Preload anything (not only images) including sounds or data loading with AJAX,
- Any action that requires uncertain amount of time (like initialising IAPs or ADs) can also be added to the preloader's list,
- It has built-in Stabilizer feature which monitors the FPS to be sure all non image related actions are completed and On completed condition can be safely triggered.
There's much more this plugin can do, yet those are topics for future tutorials. If you want to read more about the plugin, just check the description on the Scirra Store page of MM_Preloader.
If you'd like me to write tutorials about any of my plugins, just let me know!
Thanks for the read and have a great day!