I can’t figure out why my code doesn’t work. Can anyone tell me why?
public void create() {
batch = new SpriteBatch();
atlas = new TextureAtlas(Gdx.files.internal(“output/scorpion.pack”));
walkTextureRegion = new TextureRegion[10];
//image inside my pack are named “0” , “1” ,“2” and so on
for (int i = 0; i < 10; i++) {
walkTextureRegion[i] = atlas.findRegion("" + i);
}
walkAnimation = new Animation(0.06f, walkTextureRegion);
}
@Override
public void render() {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
timePassed += Gdx.graphics.getDeltaTime();
batch.begin();
batch.draw(walkAnimation.getKeyFrame(timePassed, true), 50, 50);
batch.end();
}
}