Open LoveraSantiago opened 8 years ago
Referring more of a problem.
I used TexturePacker of libgdx to transform the images of roses sheep in an atlas file. I imported the atlas file and the animation of sheep appears in anims tab window resources. Dragging it to the scene the program ends the same way.
I have the same problem. Unfortunately that make overlap2D unusable for me. Are there any intentions to fix that?
I had the same issue a time ago: https://github.com/UnderwaterApps/overlap2d/issues/382
Solution is pretty simple: Check the naming of the animation: Folder name, atlas name and name of textures have to be exactly the same [probably case-sensitive] (example: folder name = "sheep", contains "sheep.atlas" and "sheep.png"). If you don't have an atlas, but multiple images for one animation, it might work if you name them sheep001.png, sheep002.png... in a folder called sheep (I recommend using an atlas with a single image file though).
Edit: When creating the atlas (eg with a texture packer), be sure that the packer also uses the same naming for the different sprites (in my example the sheep.atlas should contain entries named "sheep01", "sheep02"...) and so on or it might not work. I can send my example sprite-animations if needed.
Still no success... I would be really grateful for your example sprite-animations!
... and by the way: what is the difference between an atlas and a pack file? Is there any, except the extension?
It's been over a year since I last dealt with the topic - I'm currently trying to recall how I did things back then.
I think I created the atlas with a texture packer and then manually edited things to match the "all-names-equal" rule.
This is an atlas file and an image file (sometimes also called "pack", I believe because it is just multiple images packed together into one single image file and the .atlas file describes the layout of the .png) of the standart-sheep (included in Overlap2D demo). Try downloading & placing these two files in a folder named sheep and import the .atlas file in Overlap2D (you have to change the extension back from .txt to .atlas, I had to change that because of GitHub limitations). If I recall correctly, Overlap2D should correctly find the .png and import the animation.
After that, check what Overlap2D did with your files: The structure should look like this:
[Project-Root]/assets/orig/sprite-animations/sheep/sheep.atlas & sheep.png
If one of the files is not named correctly, rename it (if one or more files are missing, something went completly wrong when importing (load the project before importing!)). Also you might have to check the contents of the .atlas file, see my explanations below.
Then, try dragging the sheep into the scene. If it crashes, something went wrong (tell me if that happens, my memory might be wrong). If not, everything is fine (yayyyy).
Now, let's have a look at the layout of these two files. The sheep.png is a single image, but contains all frames of the animation. This file is generated by the texture packer, along with the .atlas file (file ending should always be .atlas, not sure if .pack works also). The atlas contains information about where the different frames are. When you generate your own atlas with your own images, leave everything as-is but check the generated .atlas file manually if everything is correct = follows the "all-names-equal" rule.
I believe the culprit for me was the naming of the frames. It is critical, that every frame starts with the name of the animation: In this case, sheep. So in the atlas, you see different entries called "sheep0001", "sheep0002" and so on. This is important! These "descriptors" have to be named in this format:
animation-name | leading zero's [at least one if the number of frames is > 9] | number of frame
Usually the packers only write numbers like 001, but do not include the animation name, so you have to add this manually -> In the end, your atlas file should look pretty similar to the example.
I recommend that you look at your atlas and check if it matches this layout. If you still can't figure it out, please upload/describe what you got and I will have a look at it.
PS: Overlap2D can also generate an atlas if you provide multiple sprites. I figured out that the .atlas generated by Overlap is wrong too, so it does not help using the internal tools. Sadly I can't remember what tool I used back then to generate my packs (It was some third-party tool, neither Overlap2D nor LibGDX I believe).
PPS: I'm not sure if the sheep is already included in newly-created projects? If so, it might be a problem when trying to import an animation that is already imported -> In this case you should not use the sheep, I can send more sprites if needed.
I am having the same issue of the said link
http://overlap2d.com/forums/topic/crash-on-adding-a-sprite-animation-to-the-scene/
I'm using as images roses sheep, named as sheep0001, sheep0002 and etc. The drawings are imported, a small animation appears in the resources window in anims tab. However when dragging the animation to the scene the program quits with no message.
I'm using windows 10.