I have many diffrent animations made with flash.
I can make it as (1).SWF, (2).GIF or as (3).PNG (every Frame per second).
Searched in google... but coudn't find anything usefull.
SWF: For SWF i need Flash on the android phone... this is something new to me and because of that i woudn't prefer a solution with that.
-> I heard that Flash is not supported on Android for a long time, so this does not work.GIF: If that is possible it woud be very nice. I'm thinking of something like "animation1.start();".
But i heard that android can't handle GIF.. -.-PNG: I know how to animate many .png pictures with an animationdrawable but when i export the animations into a .png for every frame in the second... imagion how many pictures i have. The problem is that i can't make subdirectorys in the drawable folder. Why? I don't have a clue. :/ But realy, that woud suck.
Do anyone have any solution to that than pls feel free to tell me. :)
Edit: I didn't finde a easy solution so i will make it with animationdrawables.
If you have a solution... pls pls answer here :)
Answer
Export to PNG and use a texture packer to create one texture-atlas/spritesheet.
https://code.google.com/p/libgdx-texturepacker-gui/
or
http://www.codeandweb.com/texturepacker
These texturepacker export a text file( usually a json file ). This file contains all coordinate data. If you plan on using your own implementation look at the LibGDX source code and see how its making use of texture packer files.
Edit:
Because you are rather new to gamedev, it would be way easier if you just used LibGDX. If you insist on doing your own things then:
With libgdx-texturepacker-gui: first you need to understand how json works. If i'm not mistaken in the package android.util there should be a jsonreader class. You need to parse the json file and read the coordinates you need to clip the image with when you draw it. There is an example that comes with the zip file called "test-me". It shows how to pack textures.
Open the project in that folder and hit : Pack selected. It will create some files in the output folder. It will create a png ( your sheet/atlas ) and .pack file ( your json file you can open it with notepad or any other text editor and read what created based on those images)
For animations you need to do some extra work, because you create sequences based on the region names ( that's why you just need to use something like libgdx, it's all done for you).
withtexturepacker: There are several formats it can export too, but that's up to you. Same story as above you need to parse the file and need to create a function to get the region you want.
Alternatively you don't use a texture packer and create the texture atlas yourself by placing the images uniform in a sequence like so:
[][][][][] <---- animation 1 : 5 frames
[][][] <---- animation 2 : 3 frames
[][][][][][][][] <---- animation 3 : 8 frames
[][] <---- animation 4 : 2 frames
But you will not only waste space on your atlast ( meaning it might consume more memory ), you still have to write something that disects every sequence.
No comments:
Post a Comment