Difference between revisions of "Yonder"
(Created page with " == YONDER == A very simple game state manager. https://github.com/thenerdie/Yonder == TUTORIAL == First, clone the repo and open it up in your favorite code editor. This...") |
m (Added "State" keyword) |
||
Line 31: | Line 31: | ||
{{#set:Description=A ridiculously easy to use game state manager.}} | {{#set:Description=A ridiculously easy to use game state manager.}} | ||
{{#set:Name=Yonder}} | {{#set:Name=Yonder}} | ||
− | {{#set:Keyword= | + | {{#set:Keyword=State}} |
[[Category:Libraries]] | [[Category:Libraries]] |
Latest revision as of 06:13, 2 June 2021
YONDER
A very simple game state manager.
https://github.com/thenerdie/Yonder
TUTORIAL
First, clone the repo and open it up in your favorite code editor. This library is designed so that you can build straight off a fresh clone of the repo, because it has a fully functional main.lua file that can be extended off of very easily.
Next, go into the ScreenManager.lua file and look for the array titled `gameStates`. This is where you will add your screens.
To add a screen, simply add a new item in the array with the index pointing to what you want the screen to be called (this screenkey is used when you try to switch states) and the value being the required screen module.
For example:
local gameStates = { -- this is where you set the directories of your screens -- SCREENKEY REQUIRED SCREEN ["MainMenu"] = require("Screens/mainmenu") }
Now for the actual contents of the screen, I highly recommend using the template module found here: https://github.com/thenerdie/Yonder/blob/master/exampleScreen.lua
This template likely all the functionality you would need in any given screen. If you need more, all you have to do is add a new method in ScreenManager.lua that calls the method you want in your screen(s). Then call whatever method you set up in ScreenManager.lua in main.lua. Pretty simple, huh?
This should be all the info you need to get started on some serious gamedev awesomeness! If I missed anything, just let me know and I'll add it.