In my GameClass, I called the Stage.act and Stage.draw methods in the right order accordingly.
I have actions set up so that the actor fades in/fades out, bounces down/up, and also rotate, like so:
Label.LabelStyle font = new Label.LabelStyle(new BitmapFont(), Color.BLACK);
Table table = new Table();
table.center();
table.setFillParent(true);
Label playLabel = new Label("Text", font);
Action fade = new SequenceAction(Actions.fadeOut(1), Actions.fadeIn(1));
Action size = new SequenceAction(Actions.sizeBy(-20,-30,1), Actions.sizeBy(10,20,1));
Action rotate = new SequenceAction(Actions.rotateBy(20), Actions.rotateBy(-40));
ParallelAction pa = new ParallelAction(fade, size, rotate);
playLabel.addAction(Actions.repeat(RepeatAction.FOREVER, pa));
table.add(playLabel).expandX();
table.row();
stage.addActor(table);
The thing is, everything works except for the rotate method.
Similarly, I have similar problem when I use an Actor with Texture regions.
This is an example from another class.
public ReadyText () {
cam = GameClass.cam;
viewport = GameClass.viewport;
cam.setToOrtho(true, viewport.getWorldWidth(), viewport.getWorldHeight());
region = new TextureRegion(GameAssetLoader.Ready);
this.setX(28);
this.setY(165);
this.setWidth(80);
this.setHeight(30);
//fade = Actions.sequence(Actions.fadeOut(1), Actions.fadeIn(1));
Action rotate = Actions.sequence(Actions.rotateBy(80, 1), Actions.rotateBy(-90,1));
Action resize = Actions.sequence(Actions.sizeBy(10, 5,1), Actions.sizeBy(-10,-5,1));
ParallelAction pa = new ParallelAction(rotate, resize);
addAction(Actions.repeat(RepeatAction.FOREVER, pa));
}
@Override
public void draw(Batch batch, float parentAlpha) {
super.draw(batch, parentAlpha);
batch = GameClass.batch;
batch.setProjectionMatrix(GameClass.cam.combined);
batch.draw(region, this.getX(), this.getY(), this.getWidth(), this.getHeight());
}
In this example, the "sizeBy" method works fine. But for some reason, it will not rotate. I commented out the "fade in/fade out" line; it also wasn't working either.
I know people will usually use an Image Actor instead, which makes sense, but I don't think it explains why the rotation won't work, or at the very least, why the Label didn't rotate either.