Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 2 down vote accepted

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 () {;


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

share|improve this answer
Sorry, I call act right before draw. I should have added my update code... – UberLambda May 4 '13 at 16:10
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. – XiaoChuan Yu May 4 '13 at 16:13
Thanks, that solved my problem! – UberLambda May 4 '13 at 16:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.