faulty animation
prinzmnu opened this issue · 9 comments
I have no errors but the animation is drawn in a strange way as seen in the two pictures at the bottom.
I changed nothing in the api and used your implementation for libGDX.
Here is the only souce code which is written by me:
package com.randomgamedevelopment.jarumi;
import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.files.FileHandle;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.brashmonkey.spriter.Data;
import com.brashmonkey.spriter.Drawer;
import com.brashmonkey.spriter.Player;
import com.brashmonkey.spriter.SCMLReader;
import com.randomgamedevelopment.spriter.AnimationDrawer;
import com.randomgamedevelopment.spriter.AnimationLoader;
public class Jarumi extends ApplicationAdapter {
Player player;
ShapeRenderer renderer;
SpriteBatch batch;
Drawer<Sprite> drawer;
AnimationLoader loader;
OrthographicCamera cam;
@Override
public void create () {
batch = new SpriteBatch();
cam = new OrthographicCamera();
cam.zoom = 1f;
renderer = new ShapeRenderer();
FileHandle handle = Gdx.files.absolute("D:\\workspace-neo\\Yarumi\\core\\assets\\data\\char18_014.scml");
Data data = new SCMLReader(handle.read()).getData();
loader = new AnimationLoader(data);
loader.load(handle.file());
drawer = new AnimationDrawer(loader, batch, renderer);
player = new Player(data.getEntity(0));
player.setAnimation(0);
player.setPosition(300, 0);
}
@Override
public void render () {
Gdx.gl.glClearColor(1, 0, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
player.update();
drawer.draw(player);
batch.end();
}
@Override
public void dispose () {
batch.dispose();
}
}
I cannot reproduce it with the newest libGDX build.
OK - I'll do it set the project up , ensuring I use the latest build, and write if it worked
Thank you for your help.
I have still the same problem but here is the new full project for you to get an overview:
https://github.com/Yarima2/Jarumi
Is this problem actually happening in the tests, too?
Which tests are you talking about ?
the whole project is just for testing the implementation of animations
I mean the SpriterTests folder.
the LibGDX-Test runs flawless - i'll try to change it bit for bit to my setup to see what the problem is
it seems like the scml-file is the problem because your LibGDX-Test running the sample animation I used has the same buggy result as in my project.
So here is the scml-file: https://dl.dropboxusercontent.com/u/5754740/Leaf%20Girl.zip
It's a sample file which is made by the company that made spriter I think.
edit: your sample animation also runs perfectly in my project by the way
I guess the problem is, that this animation was created with an older Spriter version at a time where the file format was not final.
However if I save the file with the newest Spriter version every animation plays fine.