当我创建一个libgdx游戏项目时。我有两个文件夹。1. Gdx_game 2. Gdx_game_android
我创造了游戏。现在,我必须实现GameOver屏幕。这个gameover .java类存储在gdx_game_Android中。
因此,现在在gdx_game中,mygdxgame.java会告诉我游戏何时结束。在mygdxgame.java的gameover方法中,我想调用第二个文件夹的GameOver.java类。
我该怎么做呢?
我试过了
Intent in = new Intent(this, GameOver.class);
startActivity(in);
简而言之,我想从其他文件夹访问一个文件夹的Java类。
谢谢。
这不是您在LiBGDX中执行的操作。LiBGDX是跨平台的。它没有任何Android专用代码。您需要在Gdx_game中进行所有编码,然后仅使用Gdx_game_android项目打开Gdx_game,如下所示:
public class Gdx_Game_Android extends AndroidApplication {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
config.useAccelerometer = false;
config.useCompass = false;
config.useGL20 = true;
initialize(new Gdx_game(this), config);
}
}
编辑:
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句