我在 libgdx 中制作游戏。我想显示关于游戏开始的教程并在几秒钟后消失。我的代码如下
public class HeroCar{
static final int TUTE_STATE_SHOW = 0;
static final int TUTE_STATE_HIDE = 1;
int tuteState;
float tuteStateTime = 0;
public HeroCar()
{
tuteState = TUTE_STATE_SHOW;
}
public void update(float deltaTime){
if(tuteStateTime >= 0.56f){
tuteStateTime = 0;
tuteState = TUTE_STATE_HIDE;
}
else{
tuteState = TUTE_STATE_SHOW;
}
tuteStateTime += deltaTime;
}
and in game play screen class render method my code is
if(world.heroCar.tuteState == HeroCar.TUTE_STATE_SHOW){
spriteBatch.draw(Assets.speedingup_region, 480 / 2 - 172 / 2, 400, 172, 30);
}
}