Question

I have an animated Sprite that is drawn on the screen when I press the button. However, I want to the animation to start after 5 seconds. Technically, the ver first PNG in the "animation set" is shown and the animation starts after 5 seconds.

I have tried to used the DelayModifier as follows, but without luck:

mySprite.registerEntityModifier(new DelayModifier(500)); //doesn't work

I would appreciate your input.

Was it helpful?

Solution

I found the solution to my problem from this tutorial: http://www.andengine.org/forums/tutorials/using-timer-s-sprite-spawn-example-t463.html

The idea was to use a TimeHandler and not a DelayModifier.

OTHER TIPS

actually , you can do it with a delaymodifier too , like this

DelayModifier dMod = new DelayModifier(5f){
    @override
    public void onModifierFinished(IModifier arg0, IEntity arg1) {
        mySprite.animate(300);
    }
}
mySprite.registerEntityModifier(dMod);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top