Trouble loading files using 'Spriter management'
CookedApps opened this issue · comments
Hello @Trixt0r,
I am trying to use the Spriter class for managing my animations etc.
This is my first try on loading the resources I want and playing the animation:
Spriter.setDrawerDependencies(sb, sr);
Spriter.setLoaderDependencies();
Spriter.init(LibGdxLoader.class, LibGdxDrawer.class);
FileHandle handle = Gdx.files.internal("spriter/general/StartAnimation/AppStart.scml");
Spriter.load(handle.read(), "AppStart.scml");
player = Spriter.newPlayer("AppStart.scml", 0);
player.speed = 3;
The program crashes when calling Spriter.updateAndDraw()
and throws an exception:
Could not find file handle CookedApps_Logo.png! Please check your paths.
My "StartAnimation" folder holds exactly two files: the scml and CookedApps_Logo.png, so everything should be fine there. Maybe I misunderstand your explanation of how to use the Spriter class and loading assets with it?
Or maybe the second exception is also relevant (although i think its caused because the image cannot be found):
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Object com.brashmonkey.spriter.Loader.get(com.brashmonkey.spriter.FileReference)' on a null object reference
at com.cookedapps.robotredemption.utilities.spriter.LibGdxDrawer.draw(LibGdxDrawer.java:47)
Thanks!
Spriter.load("myfolder/myscml.scml");
Player player = Spriter.newPlayer("myfolder/myscml.scml", 0);
Is what I used. I had a bit of trouble with it before I realized how to do it.
Hope this works for you :)
You have to pass the whole relative path to the scml file, i.e.
Spriter.load(handle.read(), "spriter/general/StartAnimation/AppStart.scml");
and
player = Spriter.newPlayer("spriter/general/StartAnimation/AppStart.scml", 0);
Here is an example.