9/11/2023 0 Comments Libgdx texturepacker giving atlas![]() ![]() For the running state, we have two frames (alienGreen_run1 and alienGreen_run2) which we’ll use to create an Animation.įirst, let’s take note of all this in our Constants class: package import .Vector2 public class Constants The texture regions when the runner is hit, dodging or jumping are easy to get since they consist of a static frame (alienGreen_hit, alienGreen_dodge, and alienGreen_jump), we set a separate TextureRegion for each state and apply it inside our draw function. Both of these files are stored in the assets directory. My guess is that it would work even better for this game. LibGDX also has its own TexturePacker but I’ve never tried it. png files (they have an option for libGDX textures) and the two files were automatically generated. Well, I used TexturePacker to put together my. ![]() So if you are new to this you are probably asking yourself “What kind of sorcery is this?”. Here is the image ( characters.png):Īnd the following is the texture file ( characters.txt): characters.png format : RGBA8888 filter : Linear,Linear repeat : none alienGreen_run1 rotate : false xy : 2, 97 size : 68, 93 orig : 68, 93 offset : 0, 0 index : -1 fly_fly2 rotate : false xy : 182, 195 size : 65, 39 orig : 65, 39 offset : 0, 0 index : -1 bee_fly2 rotate : false xy : 60, 195 size : 61, 42 orig : 61, 42 offset : 0, 0 index : -1 alienGreen_jump rotate : false xy : 144, 2 size : 67, 93 orig : 67, 93 offset : 0, 0 index : -1 barnacle_bite1 rotate : false xy : 144, 97 size : 51, 57 orig : 51, 57 offset : 0, 0 index : -1 alienGreen_dodge rotate : false xy : 2, 2 size : 69, 71 orig : 69, 71 offset : 0, 0 index : -1 alienGreen_hit rotate : false xy : 73, 2 size : 69, 92 orig : 69, 92 offset : 0, 0 index : -1 ladyBug_walk1 rotate : false xy : 2, 245 size : 61, 34 orig : 61, 34 offset : 0, 0 index : -1 fly_fly1 rotate : false xy : 123, 195 size : 57, 45 orig : 57, 45 offset : 0, 0 index : -1 bee_fly1 rotate : false xy : 2, 195 size : 56, 48 orig : 56, 48 offset : 0, 0 index : -1 ladyBug_walk2 rotate : false xy : 65, 245 size : 59, 42 orig : 59, 42 offset : 0, 0 index : -1 worm_walk2 rotate : false xy : 146, 298 size : 63, 23 orig : 63, 23 offset : 0, 0 index : -1 spider_walk2 rotate : false xy : 2, 298 size : 77, 53 orig : 77, 53 offset : 0, 0 index : -1 worm_walk1 rotate : false xy : 81, 298 size : 63, 23 orig : 63, 23 offset : 0, 0 index : -1 alienGreen_run2 rotate : false xy : 72, 97 size : 70, 96 orig : 70, 96 offset : 0, 0 index : -1 barnacle_bite2 rotate : false xy : 197, 97 size : 51, 58 orig : 51, 58 offset : 0, 0 index : -1 spider_walk1 rotate : false xy : 126, 245 size : 72, 51 orig : 72, 51 offset : 0, 0 index : -1 We are going to store all his textures, along with the enemies’, in a texture atlas. ![]() So, we have four states for our guy: he’s either running, jumping, dodging or too busy getting hit by the enemies. Let’s start with the runner (I know he’s not the same as the one on the final version, sorry!). If are coming from the previous part, you probably know that we stopped showing our runner and the enemies but hey, at least the background and the ground are looking good! In this next part we are going to display our characters again. Also, a final version based on this tutorial is on Google Play. We rendered our background and ground on part 4. Check out part 1 for the project and world setup!Ĭheck out part 2 for implementing controls for our runner! ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |