I have this code for rendering a sprite, retrieved from a TextureAtlas

public class SpriteActor extends Actor {
private Sprite sprite;

public SpriteActor(TextureAtlas atlas, String spriteName) {
    sprite = atlas.createSprite(spriteName);
    this.setBounds(0, 0, this.getWidth(), this.getHeight());

public void act(float delta) {
    sprite.setPosition(this.getX(), this.getY());
    sprite.setOrigin(this.getOriginX(), this.getOriginY());
    sprite.setScale(this.getScaleX(), this.getScaleY());

public void draw(SpriteBatch batch, float parentAlpha) {
    Color color = new Color(this.getColor().r, this.getColor().g,
            this.getColor().b, this.getColor().a * parentAlpha);





EDIT: Using actions with a Image actor in the same stage works, It's only my actor that doesn't

When I set the transparency like this : actor.setColor(1, 1, 1, 0.5f); I can see the sprite becoming half transparent; or, if I set the position manually (actor.setPosition(0, 30);) I see the sprite to the correct position; but if I try to use actions (import static com.badlogic.gdx.scenes.scene2d.actions.Actions.*; [...] actor.addAction(fadeIn(3) or actor.addAction(forever(rotateBy(45), delay(1))) they just do nothing.

Do I need to implement something to have predefined actions working on my code? Or what do I need to make this code work?


1 Answer 1


This is just speculation:

Maybe you forgot to call act() on your Stage that has all the Actors. Actions are updated per frame through the act() method on each Actor which is called by Stage's act().

public void render () {

From https://code.google.com/p/libgdx/wiki/scene2d

Edit: Real problem was overriding act() without calling super.act() which updates list of Action as found in Actor class source.

  • \$\begingroup\$ Sorry, I call act right before draw. I should have added my update code... \$\endgroup\$
    – UberLambda
    Commented May 4, 2013 at 16:10
  • 2
    \$\begingroup\$ Ok, you may want to look at the source of Actor class since you're overriding act() which probably does more complex stuff than what you got there. Try calling super.act() first. \$\endgroup\$ Commented May 4, 2013 at 16:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .