Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libGDX actions: when they will execute

My code:

actor.addAction(Actions.sequence(
    Actions.fadeOut(0.3f),
    Actions.run(new Runnable(){
    @Override
    public void run() {
        Gdx.app.log(TAG,"after dispear");
    }
})));
actor.remove()

I found the action sequence will not execute at this time. If I add the actor again, it will. Can someone give me an explanation?

like image 515
BollMose Avatar asked Jul 25 '26 14:07

BollMose


1 Answers

actor.addAction(Actions.sequence(
    Actions.fadeOut(0.3f),
    Actions.run(new Runnable(){
       @Override
       public void run() {
          Gdx.app.log(TAG,"after dispear");
       }
    }),
    Actions.removeActor()));
//actor.remove(); remove this line.

To remove an actor in an action chain use "Actions.removeActor"

like image 142
ilkinulas Avatar answered Jul 28 '26 03:07

ilkinulas