JAVA實現的CrazyArcade泡泡堂游戲
https://github.com/SCNU-A225/CrazyArcade
示例圖片為了盡量復原泡泡堂游戲,我們初步實現了機器人功能。該機器人可以判斷障礙物釋放炸彈、規避炸彈、攻擊玩家。目前該機器人仍存在一些小問題,比如某些情況會卡住不動
平滑碰撞人物在拐角處移動的時候經常不是剛好對齊的狀態,程序會判定玩家碰撞了障礙物所以導致玩家無法拐彎。所以我們在處理這種情況的時候,會讓玩家進行平滑的移動使得玩家看上去是滑進去的,增強玩家游戲體驗
其它特性 音樂 使用配置文件擴展游戲 道具 單/雙人模式使用打包文件如果您僅是想試玩該泡泡堂游戲,那么可以選擇以下方式獲得打包文件夾,并執行其中的CrazyArcade.jar文件
注意:無論您使用哪種方式,在運行程序之前請確保您安裝了JRE環境
下載最新版文件,并解壓縮 克隆或下載該項目,打開RELEASE->DIST文件夾 項目文件如果您是想獲取該項目源代碼進行參考、學習或者修改,可以按以下步驟進行
使用git克隆或直接下載該項目 使用Eclipse等導入該Java項目由于編譯使用的Java版本可能不一致,如果提示錯誤請根據您電腦的環境修改項目配置 編譯并運行GameStart.java游戲入口文件聲明該項目是練習項目,沒有參與任何商業行為。
主要代碼游戲啟動入口
package com.a225.main;import java.io.IOException;import com.a225.frame.GameFrame;import com.a225.model.loader.ElementLoader;import com.a225.thread.GameMusicPlayer;/** * 游戲啟動入口 * @ClassName: GameStart * @Description: * @author: WeiXiao * @CreateDate: 2019年4月8日 下午4:17:37 */public class GameStart {private static GameFrame gameFrame;//游戲啟動入口public static void main(String[] args) {// 資源加載try {ElementLoader.getElementLoader().readGamePro();ElementLoader.getElementLoader().readImagePro();ElementLoader.getElementLoader().readCharactorsPro();ElementLoader.getElementLoader().readBubblePro();ElementLoader.getElementLoader().readSquarePro();} catch (IOException e) {System.out.println('資源加載失敗');e.printStackTrace();}//初始化gameFrame = new GameFrame();//界面顯示gameFrame.setVisible(true);//音樂播放GameMusicPlayer musicPlayer = new GameMusicPlayer();musicPlayer.start();}/** * 界面切換 * @param panelName 界面名稱 */public static void changeJPanel(String panelName){if(panelName == 'game') {GameController.setGameRunning(true);gameFrame.addListener();} else {GameController.setGameRunning(false);gameFrame.removeListener();}gameFrame.changePanel(panelName);//強制刷新,否則監聽無效gameFrame.setVisible(false);gameFrame.setVisible(true);}public static void startNewGame() {GameController.setGameRunning(true);gameFrame.startGame();changeJPanel('game');}}
游戲控制信息類
package com.a225.main;/** * 游戲控制信息類 * @ClassName: GameController * @Description: * @author: WeiXiao * @CreateDate: 2019年4月12日 上午9:13:13 */public class GameController {private static boolean gameRunning = false;private static boolean twoPlayer;private static int npcNum;public static boolean isGameRunning() {return gameRunning;}public static void setGameRunning(boolean gameRunning) {GameController.gameRunning = gameRunning;}public static boolean isTwoPlayer() {return twoPlayer;}public static void setTwoPlayer(boolean twoPlayer) {GameController.twoPlayer = twoPlayer;}public static int getNpcNum() {return npcNum;}public static void setNpcNum(int npcNum) {GameController.npcNum = npcNum;}}
代碼過多,不便全部放出,獲取完整項目,前往https://github.com/SCNU-A225/CrazyArcade
以上就是JAVA實現的CrazyArcade泡泡堂游戲的詳細內容,更多關于Java CrazyArcade泡泡堂游戲的資料請關注好吧啦網其它相關文章!
相關文章:
