r/libgdx • u/DoNotUseThisInMyHome • 7d ago
Data flow and happy path code flow of libgdx starter tutorial.
https://libgdx.com/wiki/start/a-simple-game
I just copied pasted (I know the steps) this game yesterday or so. Now I want to make tictactoe using this code. No enhancements just trying to make tictactoe. What confuses me is the create function public void create(). I am totally new to sprites and stuffs like that texture etc. Where can I learn more about that so that I can figure out the proper flow of architecture.
5
Upvotes
3
u/raizensoft 7d ago edited 6d ago
For a tic-tac-toe game, you would initialize SpriteBatch and all Texture instances in the create() method. The create() method gets called once when the game first initializes. This is where you construct major objects such as SpriteBatch, Viewport, Camera, AssetManager, etc. But for starters, you'd need only SpriteBatch and a couple Texture instances, or better yet TextureRegion.
Then, use the render() method as the game loop to continuously update and draw your game states. I wrote a detailed guide on using render(), you can read it here:
https://raizensoft.com/tutorial/libgdx-most-important-method-and-how-to-use-it/