我正在製作一款使用Libgdx框架的賽車遊戲,當遊戲結束時,屏幕上會出現遊戲重試按鈕,並通過點擊該按鈕進入遊戲屏幕,我想在其中重新開始遊戲,但不玩遊戲在遊戲結束時顯示的屏幕是最後一次。如何在遊戲結束後直接在libgdx上玩遊戲畫面?
private void updateGameOver() {
if(Gdx.input.justTouched()){
guiCam.unproject(touchPoint.set(Gdx.input.getX(), Gdx.input.getY(), 0));
if(OverlapTester.pointInRectangle(resumeButtonBounds, touchPoint.x, touchPoint.y)){
state = GAME_RUNNING;
return;
}
}
}
private void presentGameOver() {
spriteBatch.draw(Assets.retryButtonRegion, 480/2 - 183/2, 800/2 - 185, 183, 90);
}
感謝庫馬爾Saurabh您的答覆。根據你我已經改變了我的代碼和它的工作。 –