My problem is that textureAtlas animation runs on start of application. I only want it to be triggered when an inputListner gets the correct input, and not on start. Currently it gets triggered both times. What have missed? this is my code.
//show method
animationTime=0;
atlas= new TextureAtlas("Atlas/animation.atlas");
regions= new Array<TextureAtlas.AtlasRegion>(Atlas.getRegions());
animation= new Animation(1f/31f,regions);
//input listener:
animationTime = 0;
animation.setPlayMode(Animation.PlayMode.NORMAL);
//render method:
animationTime+=delta;
decal.setTextureRegion(animation.getKeyFrame(animationTime));
If you want your animation to be triggered by input you shouldn't call this line all the time :
animationTime+=delta;
cause this line of code make your animation moved, is suggest this :
// render
if(animationTrigger) {
animationTime+=delta;
}
// input listener
if(input) {
animationTrigger = true;
}
The animation will be triggered when the flag is on TRUE
If any trouble leave a comment
Good luck