Public Group

LibGDX animation error

This topic is 593 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

When I try to load in my animation picture I get an error.

@Override
public void create() {
batch = new SpriteBatch();
textureAtlas = new TextureAtlas(Gdx.files.internal("data/anim.png"));
animation = new Animation(1/15f, textureAtlas.getRegions());
}

at com.badlogic.gdx.graphics.g2d.TextureAtlas$TextureAtlasData.<init>(TextureAtlas.java:103) at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:231) at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:226) at com.badlogic.gdx.graphics.g2d.TextureAtlas.<init>(TextureAtlas.java:216) at com.mygdx.anim.RunThisOne.create(RunThisOne.java:20) at com.badlogic.gdx.backends.lwjgl.LwjglApplication.mainLoop(LwjglApplication.java:149) at com.badlogic.gdx.backends.lwjgl.LwjglApplication$1.run(LwjglApplication.java:126)

The file is correctly (to my knowledge) implemented into the project inside the "assets" folder.
I've tried changing "internal" to "local".

Share on other sites

Yeah basically it's just not finding the file for some reason.

Based on what I see there the file needs to be located at: assets/data/anim.png

And the assets folder itself should be located either in the root of your project or working directory, or on your classpath.

So if you're executing from commandline then it could be due to your current working directory not being at the root of the project.

If you're running directly from within your IDE then it's more likely a classpath issue. In Eclipse you may need to add the assets folder to your build path or convert it into a "source" folder (right click -> Build Path -> Use as source folder).

Edited by dmatter

1. 1
2. 2
3. 3
Rutin
22
4. 4
frob
17
5. 5

• 9
• 33
• 13
• 13
• 10
• Forum Statistics

• Total Topics
632582
• Total Posts
3007202

×