Try this:
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();
}
}));
he parameter "1f" is the time to run the method in this case 1f = 1 second, now each second run the method and when the count is "0" the method is removed from game.
Now for detect a lap finishes, you can extend Sprite class of you car:
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);
}
}