主游戲.javaMouseInput.javaMenu.javaHighScoreMenu.javaEnemy.javaBufferedImageLoader.java我曾經(jīng)讓這段代碼工作過(guò),但我很難知道問(wèn)題是什么。我試圖從 a 開(kāi)始joptionpane ,然后是下面創(chuàng)建的 gui 點(diǎn)擊游戲。然后回到j(luò)optionpane。然后是點(diǎn)擊游戲,這就是娛樂(lè)時(shí)搞砸的地方。它錯(cuò)誤或通過(guò)了點(diǎn)擊游戲。檢查粘貼箱。Game game = new Game();game.setPreferredSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));game.setMaximumSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));game.setMinimumSize(new Dimension(WIDTH * SCALE, HEIGHT * SCALE));JFrame frame = new JFrame(game.TITLE);frame.add(game);frame.pack();frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setResizable(false);frame.setLocationRelativeTo(null);frame.setVisible(true);frame.setExtendedState(JFrame.MAXIMIZED_BOTH);game.start(); 我嘗試將我的代碼重置為默認(rèn)值,嘗試再次創(chuàng)建我想要的游戲,joptionpane但它不再起作用。看起來(lái)我的電腦不想再玩它了?我已經(jīng)進(jìn)行了更改,但我只是不知道是什么關(guān)閉了我的功能。@Overridepublic void run() { init(); long lastTime = System.nanoTime(); final double amountOfTicks = 60.0; double ns = 1000000000 / amountOfTicks; double delta = 0; int updates = 0; int frames = 0; long timer = System.currentTimeMillis(); while (running) { // this would be the game loop long now = System.nanoTime(); delta += (now - lastTime) / ns; lastTime = now; if (delta >= 1) { tick(); final int i = updates++; delta--; } render(); frames++; if (System.currentTimeMillis() - timer > 1000) { timer += 1000; //System.out.println(updates + " Ticks, FPS " + frames); updates = 0; frames = 0; } } stop();}private void render() { BufferStrategy bs = this.getBufferStrategy(); if (bs == null) { createBufferStrategy(2000); createBufferStrategy(2); return; }
1 回答

繁星淼淼
TA貢獻(xiàn)1775條經(jīng)驗(yàn) 獲得超11個(gè)贊
Game.State = STATE.MENU;
這是在創(chuàng)建游戲狀態(tài)之前需要的。這就是那里的情況。
Game.State (STATE.MENU);
添加回答
舉報(bào)
0/150
提交
取消