/** Level initialization handled here */ public void initGame() { // First level initializations-burada can da sıfırlanmalı, oyunu restart yapan method bu olmalı if (currentLevel == 1) { boat.setFlashForward(false); // init bonus state boat.replenishUsedNumOfBullets(); // init bonus state // boat.setNumOfLives(INITIAL_BOAT_LIFE_AMOUNT);//init bonus state boat.setBoatImage(mgf.getBoatColor()); // To set the proper image from the main game frame // setDifficultInBoat(mgf.getDifficulty()); // System.out.println("difffi: " + mgf.getDifficulty()); if (mgf.getDifficulty()) { boat.setNumOfLives(INITIAL_BOAT_LIFE_AMOUNT - 2); } else { boat.setNumOfLives(INITIAL_BOAT_LIFE_AMOUNT); } boat.setDirectionKeysOn(mgf.getControls()); boat.setPosition(0, 20); boat.setDirection(0); boat.setVisible(true); // Game object positions buoyPositions = new int[][] { {250, 500}, {300, 100}, {500, 300}, {450, 125}, {400, 200}, {350, 400}, {200, 250} }; islandPositions = new int[][] { {50, 175}, // small {550, 300}, // medium {50, 450} // medium }; islandTypes = new String[] {"small", "medium", "medium"}; bonusPositions = new int[][] {{60, 350}, {500, 550}}; gamePoint = 0; initBuoys(); initIslands(); initBonuses(); System.out.println("inside init game level-1"); } // other level initializations if (currentLevel == 2) { initGameLevel2(); } if (currentLevel == 3) { initGameLevel3(); } }
private void initGameLevel3() { boat.setFlashForward(false); // init bonus state boat.replenishUsedNumOfBullets(); // init bonus state boat.setNumOfLives(INITIAL_BOAT_LIFE_AMOUNT); // init bonus state boat.setBoatImage(mgf.getBoatColor()); boat.setPosition(0, 20); boat.setDirection(0); boat.setVisible(true); // Game object positions buoyPositions = new int[][] { {400, 500}, {350, 120}, {630, 400}, {500, 145}, {50, 550}, {650, 200}, {250, 400}, {200, 250}, {600, 630}, {60, 375} }; islandPositions = new int[][] { {50, 100}, // medium {550, 500}, // small {100, 500}, // medium {300, 200} // large }; islandTypes = new String[] {"medium", "small", "medium", "large"}; bonusPositions = new int[][] {{250, 100}, {80, 310}, {450, 550}, {600, 330}}; initBuoys(); initIslands(); initBonuses(); System.out.println("inside init game level-3"); }
private void initGameLevel2() { boat.setFlashForward(false); // init bonus state boat.replenishUsedNumOfBullets(); // init bonus state boat.setNumOfLives(INITIAL_BOAT_LIFE_AMOUNT); // init bonus state boat.setBoatImage(mgf.getBoatColor()); boat.setPosition(0, 20); boat.setDirection(0); boat.setVisible(true); // Game object positions buoyPositions = new int[][] {{100, 100}, {200, 300}, {100, 150}, {200, 600}, {400, 400}, {500, 650}}; islandPositions = new int[][] { {40, 300}, // Small islands {500, 200}, // Medium islands {400, 400} // Large islands }; islandTypes = new String[] {"small", "medium", "large"}; bonusPositions = new int[][] {{100, 500}, {500, 100}, {400, 200}}; initBuoys(); initIslands(); initBonuses(); System.out.println("inside init game level-2"); }