ステージ上のアクターがタッチされたときにのみ関数を実行したい..しかし問題は、ステージ上のどこに触れても関数が実行されることです..ステージ上のランダムな場所に触れたとしても、関数は実行されます. . アクターがタッチされたときにのみ関数を実行したい..境界を設定しています...それでも機能しません..
public Restart()
{
atlas = new TextureAtlas(Gdx.files.internal("pages-info.atlas"));
sprite = atlas.createSprite("restart");
this.touchable = true;
sprite.setBounds(x, y, sprite.getWidth(), sprite.getHeight());
}
public void draw(SpriteBatch batch,float parentAlpha)
{
batch.draw(sprite, x, y , width, height );
}
@Override
public Actor hit(float x, float y)
{
// TODO Auto-generated method stub
Gdx.app.log( FirstGame.LOG, " restart working " );
return null;
}