small fixes

This commit is contained in:
musilto9 2020-06-04 12:37:57 +02:00
parent 1d152e2773
commit 28559cbb7e
6 changed files with 107 additions and 9 deletions

View File

@ -313,6 +313,13 @@ public class Map {
return false;
}
public boolean isTriggerCell(int x, int y) {
for (TriggerCell cell : triggerCells)
if (x == cell.getX() && y == cell.getY() && cell.getClass().getName().equals("ruscz.game.gameOfProd.Cells.TriggerCell"))
return true;
return false;
}
public boolean isDoor(int x, int y) {
for (DoorCell cell : doorCells)
if (x == cell.getX() && y == cell.getY() && cell.getClass().getName().equals("ruscz.game.gameOfProd.Cells.DoorCell")) {

View File

@ -51,6 +51,10 @@ public class MapManager {
public LoadManager getLoadManager() { return loadManager; }
public SaveManager getSaveManager() {
return saveManager;
}
public void createMap() {
for (int i = 0; i < actualMap.getMapArray().length; i++) {
for (int j = 0; j < actualMap.getMapArray()[0].length; j++) {

View File

@ -54,7 +54,7 @@ public class PathFinder {
for (int i = 0; i < map.getMapArray().length; i++) {
for (int j = 0; j < map.getMapArray()[0].length; j++) {
if (map.getMapArray()[i][j] == TypeOfCell.BLOCK || map.getMapArray()[i][j] == TypeOfCell.EVENT) {
if (map.getMapArray()[i][j] == TypeOfCell.BLOCK || (map.getMapArray()[i][j] == TypeOfCell.EVENT && !map.isTriggerCell(i, j))) {
aStar.setBlock(i, j);
}
}

View File

@ -1,15 +1,19 @@
package ruscz.game.gameOfProd.Windows;
import ruscz.game.gameOfProd.Battle.*;
import ruscz.game.gameOfProd.Battle.Battle;
import ruscz.game.gameOfProd.Battle.BattlePerson;
import ruscz.game.gameOfProd.Battle.Enemy;
import ruscz.game.gameOfProd.Battle.Hero;
import ruscz.game.gameOfProd.BattleUI.*;
import ruscz.game.gameOfProd.Game;
import ruscz.game.gameOfProd.Save.LoadManager;
import ruscz.game.gameOfProd.Save.SaveManager;
import ruscz.game.gameOfProd.Sounds.MusicManager;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.WindowEvent;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.LinkedList;
@ -105,7 +109,7 @@ public class WindowOfBattle extends JPanel {
}
public void startBattle(String name) {
SaveManager saveManager = new SaveManager(game.getFreeMove().getMapManager());
SaveManager saveManager = game.getFreeMove().getMapManager().getSaveManager();
saveManager.saveGame();
LinkedList<Hero> heroes = new LinkedList<>();
@ -134,7 +138,7 @@ public class WindowOfBattle extends JPanel {
e.printStackTrace();
}
MusicManager musicManager = new MusicManager("Fight_Music.wav", 0.0f);
MusicManager musicManager = new MusicManager("Fight_Music.wav", -15.0f);
battle = new Battle(heroes, enemies, this);
isReadyToPaint = true;
@ -151,9 +155,6 @@ public class WindowOfBattle extends JPanel {
musicManager.playMusic();
musicManager.setVolumeToMaxVolume();
}
LoadManager loadManager = new LoadManager(game.getFreeMove().getMapManager());
loadManager.loadSavedGame();
}
public Canvas getCanvas() {

View File

@ -0,0 +1,80 @@
<map>
<mapName>tutorial</mapName>
<events>
<trigger>
<x>11</x>
<y>6</y>
<active>false</active>
</trigger>
</events>
</map>
<map>
<mapName>openspace</mapName>
<events>
<trigger>
<x>6</x>
<y>4</y>
<active>true</active>
</trigger>
<trigger>
<x>14</x>
<y>16</y>
<active>false</active>
</trigger>
<chest>
<x>1</x>
<y>2</y>
<active>true</active>
</chest>
<chest>
<x>15</x>
<y>7</y>
<active>true</active>
</chest>
</events>
</map>
<map>
<mapName>office</mapName>
<events>
<trigger>
<x>4</x>
<y>2</y>
<active>false</active>
</trigger>
<chest>
<x>1</x>
<y>9</y>
<active>true</active>
</chest>
</events>
</map>
<map>
<mapName>boss</mapName>
<events>
<trigger>
<x>4</x>
<y>18</y>
<active>true</active>
</trigger>
</events>
</map>
<map>
<mapName>treasure</mapName>
<events>
<trigger>
<x>6</x>
<y>1</y>
<active>true</active>
</trigger>
</events>
</map>
<map>
<mapName>storageroom</mapName>
<events>
<trigger>
<x>6</x>
<y>2</y>
<active>false</active>
</trigger>
</events>
</map>

View File

@ -0,0 +1,6 @@
<location>
<map>storageroom</map>
<x>6</x>
<y>2</y>
<direction>0</direction>
</location>