11/25/2023 0 Comments Libgdx texturepacker giving atlasIt is more efficient to load one texture and use parts of it while rendering different sprites in the scene.įor our project we made two TextureAtlases, one containing textures for the menu and another containing textures for the game objects.įor Textures we created a class called Assets which stores textures in static variables. It is a tool using which we pack different textures in one single big file called TextureAtlas which can be used to draw parts of it for particular sprites. In the constructor we call the Initialize function which is used to load the textures and setting up positions of objects.īefore we go further we would like to mention the tool Texture Packer available in libgdx project page. We just extend the Screen class to get the different screen types we specify for our game like MainMenu, Instruction, Option etc. Public abstract void OnResume() //Useful for Android code to do processing when the game regains focus Public abstract void OnPause() //Useful for Android code to do processing when the game loses focus Public abstract void render (Application app) Public abstract void update (Application app) Public Application App //Stores reference of the Application Public int IsDone //Tells whether the screen is ready to be destroyed Public int ScreenType //Stores the type of screen like MainMenu,OptionMenu, GameplayScreen This helps in maintaining a similar structure across all the pages. We have these menus in our game:Īll the different screens in the game extend a base abstract class Screen. So in Assets/Textures we would put our textures. It is better to keep it organized so we make folders for textures, fonts, sounds, data files. Now in assets we can put all the files we want to load in our game. Here is the screenshot of the folder structure of the project. We would take our game Polar as a reference.īefore going into the screens we would make a folder called assets in Android Project. Alvarez.In this post we will concentrate on different screens which are a part of a game like menus, scoreboard and gameplay.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |