이 시도 :
int count=60;
youScene.registerUpdateHandler(new TimerHandler(1f, true, new ITimerCallback() {
@Override
public void onTimePassed(TimerHandler pTimerHandler) {
count--;
youchangeabletext.setText(String.valueof(count));
if(count==0){
youScene.unregisterUpdateHandler(pTimerHandler);
//GameOver();
}
pTimerHandler.reset();
}
}));
그가 "1F"매개 변수,이 경우 층 = 1 초 지금 초당 실행 방법 및 카운트는 "0"이 방법을 방법을 실행할 수있는 시간 게임에서 제거되었습니다. 무릎 완료를 감지하기위한
지금, 당신은 당신이 차의 Sprite 클래스를 확장 할 수
public class Car extends AnimatedSprite {
public Car(final float pX, final float pY, final TiledTextureRegion pTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager) {
super(pX, pY, pTextureRegion, pVertexBufferObjectManager);
}
//the method onManagedUpdate run in milliseconds
@Override
protected void onManagedUpdate(final float pSecondsElapsed) {
//for example when car is in the position 100 in x
if(this.getX()>=100){
//lap finish
}
super.onManagedUpdate(pSecondsElapsed);
}
}