![]() It’s defined in an *.atlas file and sits alongside the image in the libGDX assets folder. Creating a Texture Atlas for LibGDXĪ texture atlas can basically define regions on your sprite sheet. In order to split up the one sprite sheet into four separate animations easily, I created a Texture Atlas for the sprite sheet. To simplify drawing, I created a PlayerDrawer class, which chooses which animation and which frame to draw based on the time and player state. getKeyFrame() method which will return the frame in the sprite sheet that is to be drawn at that point in time. An Animation object can be instantiated with an Array of the textures that make up an animation. ![]() Perfect for my infinite runner game! Player Animation with LibGDX ![]() This sprite sheet contains frames for standing, running, jumping and falling. An example is shown below, taken from OpenGameArt – link here This sequence of images can be collated into one image, called a sprite sheet. The Basics of Animation with Sprite SheetsĢD Animation, like in Television and Film, works by displaying images (each called a frame) in quick succession. To do this, we need to know a little about Animation. No more default libGDX happy smiley face Texture □ ![]() I know I haven’t posted in a while, but the Infinite Runner project continues! Today I’ll be adding a character sprite sheet to the game. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |