Thursday, March 30, 2017

libgdx - How to use moveTo Actor?


How to use moveTo?


I do so:


actor.addAction(Actions.moveTo(500, 500, 10));

but he does not move


Thanks you



UPDATE


does not move


my code:


public class MyActions extends ApplicationAdapter {
private Stage stage;
private Actor actor;

@Override
public void create () {


stage = new Stage();
actor = new Actor(){
{
setSize(100, 100);
}
Sprite actorSprite = new Sprite(new Texture(Gdx.files.internal("badlogic.jpg")), 57, 10, (int)getWidth(), (int)getHeight());

@Override
public void draw(Batch batch, float parentAlpha) {
actorSprite.draw(batch, parentAlpha);

}
};

stage.addActor(actor);
actor.addAction(Actions.moveTo(500, 500, 1));
}


@Override
public void render () {

Gdx.gl.glClearColor(1, 1, 0, 1);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
actor.act(Gdx.graphics.getDeltaTime());
//stage.act();
stage.draw();
}
}

what's wrong?




No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...