I want to rotate my image on touch but it never applies action, I'm using RotateToAction to achieve this.
class actorCark extends Actor
{
Texture texture;
Sprite sprite;
Global g;
GetActorByName a;
public actorCark()
{
ses=new sesler();
g=new Global();
a=new GetActorByName();
sr=new soruSor();
texture=new Texture(Gdx.files.internal("images/carkifelek.png"));
sprite=new Sprite(texture);
setBounds(Global.screen_width / 2 - Global.screen_height * 0.9F * sprite.getTexture().getWidth() / sprite.getTexture().getHeight() / 2, Global.screen_height / 2 - Global.screen_height * 0.9F / 2, Global.screen_height * 0.9F * sprite.getTexture().getWidth() / sprite.getTexture().getHeight(), Global.screen_height * 0.9F);
setTouchable(Touchable.enabled);
addListener(new InputListener() {
public boolean touchDown(InputEvent event, float x, float y, int pointer, int buttons) {
clearActions();
RotateToAction rotateToAction=new RotateToAction();
rotateToAction.setRotation(360);
rotateToAction.setDuration(2);
addAction(rotateToAction);
dondur();
sesler.donmeS.play();
return true;
}
});
}
@Override
public void act(float delta) {
super.act(delta);
}
public void draw(Batch batch, float alpha)
{
sprite.getTexture().setFilter(Texture.TextureFilter.Linear, Texture.TextureFilter.Linear);
sprite.setBounds(Global.screen_width / 2 - Global.screen_height * 0.9F * sprite.getTexture().getWidth() / sprite.getTexture().getHeight() / 2, Global.screen_height / 2 - Global.screen_height * 0.9F / 2, Global.screen_height * 0.9F * sprite.getTexture().getWidth() / sprite.getTexture().getHeight(), Global.screen_height * 0.9F);
sprite.setOrigin(sprite.getWidth() / 2, sprite.getHeight() / 2);
sprite.draw(batch);
}
}