2014-11-06 71 views
1

我的GameRenderer類中的補間不起作用。他們不顯示錯誤,但他們只是被忽略。補間被忽略LibGDX

TweenManager tweenManager; 
public class GameRenderer(GameWorld g){ 
... 
tweenManager = new TweenManager(); 
initButton(); 
} 
void initButton(){ 
.. initializing button .. 
button.addListener(new ClickListener(){ 
     @Override 
     public void clicked(InputEvent event, float x, float y){ 
      Tween.registerAccessor(ShapeRenderer.class, new ShapeAccessor()); 
      Tween.set(fader, ShapeAccessor.ALPHA).target(fader.getColor().a).start(tweenManager); 
      Tween.to(fader, ShapeAccessor.ALPHA, 2).target(1).start(tweenManager); 
      Tween.registerAccessor(Music.class, new MusicAccessor()); 
      Tween.set(crowd, MusicAccessor.VOLUME).cast(Music.class).target(1).start(tweenManager); 
      Tween.to(crowd, MusicAccessor.VOLUME, 2).cast(Music.class).target(0).setCallback(new TweenCallback(){ 
       @Override 
       public void onEvent(int arg0, BaseTween<?> arg1) { 
        ((Game) Gdx.app.getApplicationListener()).setScreen(new GameScreen()); 
       } 
      }).start(tManager); 
     } 
    }); 
} 

當我點擊按鈕它被註冊爲點擊,但補間被忽略。

回答

0

確保您更新您的漸變經理渲染()方法,像這樣:

tweenManager.update(Gdx.graphics.getDeltaTime());

+0

謝謝,我忘了。 – Roberisha 2014-12-19 15:06:36

+0

@Roberisha你能解釋一下你的'MusicAccessor'如何實現'Music'接口嗎? – WeirdElfB0y 2015-08-24 09:45:16