jeudi 26 avril 2018

Libgdx passing actions of an actor to another actor

Ok so basically I'm trying to decorate a Libgdx Actor class with other actions

 public Shake(Button buttonToBeDecorated) {
      super(buttonToBeDecorated);
      Array<Action> actions = buttonToBeDecorated.getActions();

      for (Action action : actions)
            addAction((action));

      addAction(Actions.forever(new SequenceAction(
             Actions.moveBy(10, 0, 0.5f),
             Actions.moveBy(-10, 0, 0.5f)))
      );

 }

however actions from toBeDecorated class (which are also wrapped in SequenceAction) doesn't apply to instance of Shake. I'm sure that actions are passed properly because I am able to print them out. But I'm not getting combined effect, maybe some of you would know why ? Thanks

Aucun commentaire:

Enregistrer un commentaire