a lot of final fixes
@ -23,8 +23,8 @@ public class Npc extends Person {
|
|||||||
private int height;
|
private int height;
|
||||||
private int offsetX;
|
private int offsetX;
|
||||||
private int offsetY;
|
private int offsetY;
|
||||||
private int widthCoef;
|
private double widthCoef;
|
||||||
private int heightCoef;
|
private double heightCoef;
|
||||||
private String imageNpc;
|
private String imageNpc;
|
||||||
private String battle;
|
private String battle;
|
||||||
private Timer timer;
|
private Timer timer;
|
||||||
@ -121,8 +121,8 @@ public class Npc extends Person {
|
|||||||
direction = Integer.parseInt(imageInfo[2]);
|
direction = Integer.parseInt(imageInfo[2]);
|
||||||
offsetX = Integer.parseInt(imageInfo[3]);
|
offsetX = Integer.parseInt(imageInfo[3]);
|
||||||
offsetY = Integer.parseInt(imageInfo[4]);
|
offsetY = Integer.parseInt(imageInfo[4]);
|
||||||
widthCoef = Integer.parseInt(imageInfo[5]);
|
widthCoef = Double.parseDouble(imageInfo[5]);
|
||||||
heightCoef = Integer.parseInt(imageInfo[6]);
|
heightCoef = Double.parseDouble(imageInfo[6]);
|
||||||
imageNpc = scanner.nextLine();
|
imageNpc = scanner.nextLine();
|
||||||
if (scanner.hasNextLine()) battle = scanner.nextLine();
|
if (scanner.hasNextLine()) battle = scanner.nextLine();
|
||||||
}
|
}
|
||||||
@ -134,7 +134,7 @@ public class Npc extends Person {
|
|||||||
try {
|
try {
|
||||||
image = ImageIO.read(new File("src/main/resources/characters/" + name + "/" + imageNpc)).getSubimage(width * direction, 0, width, height);
|
image = ImageIO.read(new File("src/main/resources/characters/" + name + "/" + imageNpc)).getSubimage(width * direction, 0, width, height);
|
||||||
g.drawImage(image, getX() * getSize() + (getSize() / 5) + offsetX,
|
g.drawImage(image, getX() * getSize() + (getSize() / 5) + offsetX,
|
||||||
getY() * getSize() - (getSize() * 3 / 5) + offsetY, getSize() * widthCoef / 5, getSize() * heightCoef / 2, null);
|
getY() * getSize() - (getSize() * 3 / 5) + offsetY, (int) (getSize() * widthCoef / 5), (int) (getSize() * heightCoef / 2), null);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,8 +5,11 @@ import ruscz.game.gameOfProd.Windows.WindowOfBattle;
|
|||||||
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
|
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
|
||||||
import ruscz.game.gameOfProd.Windows.WindowOfMenu;
|
import ruscz.game.gameOfProd.Windows.WindowOfMenu;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
public class Game extends JFrame {
|
public class Game extends JFrame {
|
||||||
private static final int WINDOW_WIDTH = 13;
|
private static final int WINDOW_WIDTH = 13;
|
||||||
@ -61,6 +64,11 @@ public class Game extends JFrame {
|
|||||||
setVisible(true);
|
setVisible(true);
|
||||||
getContentPane().setBackground(Color.BLACK);
|
getContentPane().setBackground(Color.BLACK);
|
||||||
setExtendedState(MAXIMIZED_BOTH);
|
setExtendedState(MAXIMIZED_BOTH);
|
||||||
|
try {
|
||||||
|
setIconImage(ImageIO.read(new File("src/main/resources/images/icon.png")).getScaledInstance(64, 64, Image.SCALE_DEFAULT));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Game game() {
|
public Game game() {
|
||||||
|
|||||||
@ -80,9 +80,10 @@ public class CellSetConfig {
|
|||||||
|
|
||||||
infoPanel.add(saveInfo);
|
infoPanel.add(saveInfo);
|
||||||
|
|
||||||
scrollInfo.revalidate();
|
// scrollInfo.revalidate();
|
||||||
scrollInfo.requestFocus();
|
// scrollInfo.requestFocus();
|
||||||
view.add(scrollInfo);
|
view.add(scrollInfo);
|
||||||
|
scrollInfo.repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
private JLabel nameLabel(String name, int offset) {
|
private JLabel nameLabel(String name, int offset) {
|
||||||
|
|||||||
@ -57,8 +57,8 @@ public class EditorSaveManager {
|
|||||||
for (int i = 0; i < editor.getMapHeight(); i++) {
|
for (int i = 0; i < editor.getMapHeight(); i++) {
|
||||||
for (int j = 0; j < editor.getMapWidth(); j++) {
|
for (int j = 0; j < editor.getMapWidth(); j++) {
|
||||||
if (j != 0) info += " ";
|
if (j != 0) info += " ";
|
||||||
if (set[i][j].split(",")[0].contains("door")) info += "EMPTY";
|
if (set[j][i].split(",")[0].contains("door")) info += "EMPTY";
|
||||||
else info += set[i][j];
|
else info += set[j][i];
|
||||||
if (j == editor.getMapWidth() - 1 && i != editor.getMapHeight() - 1) info += System.lineSeparator();
|
if (j == editor.getMapWidth() - 1 && i != editor.getMapHeight() - 1) info += System.lineSeparator();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -35,11 +35,6 @@ public class InfoManager {
|
|||||||
info.setBounds(20, 200, 260, 730);
|
info.setBounds(20, 200, 260, 730);
|
||||||
info.setLayout(null);
|
info.setLayout(null);
|
||||||
|
|
||||||
detailedCellInfo = new DetailedCellInfo(editor, x, y);
|
|
||||||
detailedCellInfo.setBounds(20, 270, 260, 520);
|
|
||||||
detailedCellInfo.setLayout(null);
|
|
||||||
detailedCellInfo.setVisible(false);
|
|
||||||
|
|
||||||
switch (layer) {
|
switch (layer) {
|
||||||
case "object":
|
case "object":
|
||||||
displayObjectAndTileInfo(label, x, y, true);
|
displayObjectAndTileInfo(label, x, y, true);
|
||||||
@ -52,7 +47,6 @@ public class InfoManager {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
view.add(detailedCellInfo, JLayeredPane.POPUP_LAYER);
|
|
||||||
view.add(info, JLayeredPane.MODAL_LAYER);
|
view.add(info, JLayeredPane.MODAL_LAYER);
|
||||||
view.revalidate();
|
view.revalidate();
|
||||||
}
|
}
|
||||||
@ -149,6 +143,7 @@ public class InfoManager {
|
|||||||
editor.getMapLayers().repaintTileset();
|
editor.getMapLayers().repaintTileset();
|
||||||
}
|
}
|
||||||
info.removeAll();
|
info.removeAll();
|
||||||
|
info.setVisible(false);
|
||||||
view.remove(info);
|
view.remove(info);
|
||||||
view.revalidate();
|
view.revalidate();
|
||||||
view.repaint();
|
view.repaint();
|
||||||
@ -166,6 +161,12 @@ public class InfoManager {
|
|||||||
private void displayCellInfo(JLabel label, int x, int y) {
|
private void displayCellInfo(JLabel label, int x, int y) {
|
||||||
String[] array = {"EMPTY", "BLOCK", "INTER", "TRIGGER", "MOVETO", "DOOR", "DOORTO", "CHEST"};
|
String[] array = {"EMPTY", "BLOCK", "INTER", "TRIGGER", "MOVETO", "DOOR", "DOORTO", "CHEST"};
|
||||||
|
|
||||||
|
detailedCellInfo = new DetailedCellInfo(editor, x, y);
|
||||||
|
detailedCellInfo.setBounds(20, 270, 260, 520);
|
||||||
|
detailedCellInfo.setLayout(null);
|
||||||
|
detailedCellInfo.setVisible(false);
|
||||||
|
view.add(detailedCellInfo, JLayeredPane.POPUP_LAYER);
|
||||||
|
|
||||||
JLabel infoLabel = new JLabel();
|
JLabel infoLabel = new JLabel();
|
||||||
infoLabel.setBounds(0, 0, 50, 50);
|
infoLabel.setBounds(0, 0, 50, 50);
|
||||||
infoLabel.setIcon(label.getIcon());
|
infoLabel.setIcon(label.getIcon());
|
||||||
@ -208,13 +209,12 @@ public class InfoManager {
|
|||||||
|
|
||||||
openCellMap.setBounds(30, 600, 200, 30);
|
openCellMap.setBounds(30, 600, 200, 30);
|
||||||
openCellMap.addActionListener(e -> {
|
openCellMap.addActionListener(e -> {
|
||||||
info.removeAll();
|
// info.removeAll();
|
||||||
info.revalidate();
|
// info.revalidate();
|
||||||
detailedCellInfo.removeAll();
|
// detailedCellInfo.removeAll();
|
||||||
detailedCellInfo.revalidate();
|
// detailedCellInfo.revalidate();
|
||||||
view.remove(info);
|
view.remove(info);
|
||||||
view.remove(detailedCellInfo);
|
view.remove(detailedCellInfo);
|
||||||
view.revalidate();
|
|
||||||
new CellSetConfig(editor, scrollInfo).displayCellSetConfig();
|
new CellSetConfig(editor, scrollInfo).displayCellSetConfig();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -259,4 +259,8 @@ public class InfoManager {
|
|||||||
editor.getCellArray()[x][y+1] = value;
|
editor.getCellArray()[x][y+1] = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JPanel getInfo() {
|
||||||
|
return info;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import ruscz.game.gameOfProd.Cells.TypeOfCell;
|
|||||||
import ruscz.game.gameOfProd.Map.Map;
|
import ruscz.game.gameOfProd.Map.Map;
|
||||||
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
|
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
@ -11,6 +12,8 @@ import java.awt.event.ActionListener;
|
|||||||
import java.awt.event.MouseEvent;
|
import java.awt.event.MouseEvent;
|
||||||
import java.awt.event.MouseListener;
|
import java.awt.event.MouseListener;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
@ -88,8 +91,7 @@ public class LevelEditor extends JFrame {
|
|||||||
view.revalidate();
|
view.revalidate();
|
||||||
view.repaint();
|
view.repaint();
|
||||||
createNewMap(name, width, height);
|
createNewMap(name, width, height);
|
||||||
}
|
} catch (NumberFormatException ex) {
|
||||||
catch (NumberFormatException ex) {
|
|
||||||
error.setText("<html><div style='text-align: center; width: 1300; color: red'>One or more values (apart from Name) is not an Integer.</div></html>");
|
error.setText("<html><div style='text-align: center; width: 1300; color: red'>One or more values (apart from Name) is not an Integer.</div></html>");
|
||||||
error.setVisible(true);
|
error.setVisible(true);
|
||||||
}
|
}
|
||||||
@ -114,6 +116,11 @@ public class LevelEditor extends JFrame {
|
|||||||
setLayout(null);
|
setLayout(null);
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
setResizable(false);
|
setResizable(false);
|
||||||
|
try {
|
||||||
|
setIconImage(ImageIO.read(new File("src/main/resources/images/icon.png")).getScaledInstance(64, 64, Image.SCALE_DEFAULT));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void createNewMap(String name, int width, int height) {
|
public void createNewMap(String name, int width, int height) {
|
||||||
@ -152,6 +159,7 @@ public class LevelEditor extends JFrame {
|
|||||||
importTilesets.addActionListener(e -> {
|
importTilesets.addActionListener(e -> {
|
||||||
imagesOfTiles = overview.getImagesOfTiles();
|
imagesOfTiles = overview.getImagesOfTiles();
|
||||||
mapLayersManager.repaintSets();
|
mapLayersManager.repaintSets();
|
||||||
|
if (infoManager.getInfo() != null) infoManager.getInfo().repaint();
|
||||||
});
|
});
|
||||||
|
|
||||||
JButton openTilesets = new JButton("Open Tileset Overview");
|
JButton openTilesets = new JButton("Open Tileset Overview");
|
||||||
@ -189,6 +197,13 @@ public class LevelEditor extends JFrame {
|
|||||||
objectBox.setBounds(600, 30, 30, 20);
|
objectBox.setBounds(600, 30, 30, 20);
|
||||||
objectBox.setSelected(true);
|
objectBox.setSelected(true);
|
||||||
objectBox.addActionListener(actionEvent -> {
|
objectBox.addActionListener(actionEvent -> {
|
||||||
|
if (infoManager.getInfo() != null) {
|
||||||
|
infoManager.getInfo().removeAll();
|
||||||
|
infoManager.getInfo().setVisible(false);
|
||||||
|
view.remove(infoManager.getInfo());
|
||||||
|
view.revalidate();
|
||||||
|
view.repaint();
|
||||||
|
}
|
||||||
if (objectSet.isVisible()) objectSet.setVisible(false);
|
if (objectSet.isVisible()) objectSet.setVisible(false);
|
||||||
else {
|
else {
|
||||||
objectSet.setVisible(true);
|
objectSet.setVisible(true);
|
||||||
@ -201,6 +216,13 @@ public class LevelEditor extends JFrame {
|
|||||||
cellBox.setBounds(850, 30, 30, 20);
|
cellBox.setBounds(850, 30, 30, 20);
|
||||||
cellBox.setSelected(true);
|
cellBox.setSelected(true);
|
||||||
cellBox.addActionListener(actionEvent -> {
|
cellBox.addActionListener(actionEvent -> {
|
||||||
|
if (infoManager.getInfo() != null) {
|
||||||
|
infoManager.getInfo().removeAll();
|
||||||
|
infoManager.getInfo().setVisible(false);
|
||||||
|
view.remove(infoManager.getInfo());
|
||||||
|
view.revalidate();
|
||||||
|
view.repaint();
|
||||||
|
}
|
||||||
if (cellSet.isVisible()) cellSet.setVisible(false);
|
if (cellSet.isVisible()) cellSet.setVisible(false);
|
||||||
else cellSet.setVisible(true);
|
else cellSet.setVisible(true);
|
||||||
});
|
});
|
||||||
@ -211,6 +233,13 @@ public class LevelEditor extends JFrame {
|
|||||||
tileBox.setBounds(1030, 30, 30, 20);
|
tileBox.setBounds(1030, 30, 30, 20);
|
||||||
tileBox.setSelected(true);
|
tileBox.setSelected(true);
|
||||||
tileBox.addActionListener(actionEvent -> {
|
tileBox.addActionListener(actionEvent -> {
|
||||||
|
if (infoManager.getInfo() != null) {
|
||||||
|
infoManager.getInfo().removeAll();
|
||||||
|
infoManager.getInfo().setVisible(false);
|
||||||
|
view.remove(infoManager.getInfo());
|
||||||
|
view.revalidate();
|
||||||
|
view.repaint();
|
||||||
|
}
|
||||||
if (tileSet.isVisible()) tileSet.setVisible(false);
|
if (tileSet.isVisible()) tileSet.setVisible(false);
|
||||||
else tileSet.setVisible(true);
|
else tileSet.setVisible(true);
|
||||||
});
|
});
|
||||||
@ -228,8 +257,13 @@ public class LevelEditor extends JFrame {
|
|||||||
new EditorSaveManager(getEditor()).saveMap();
|
new EditorSaveManager(getEditor()).saveMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public void mousePressed(MouseEvent e) {}
|
@Override
|
||||||
@Override public void mouseReleased(MouseEvent e) {}
|
public void mousePressed(MouseEvent e) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseReleased(MouseEvent e) {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseEntered(MouseEvent e) {
|
public void mouseEntered(MouseEvent e) {
|
||||||
@ -280,7 +314,9 @@ public class LevelEditor extends JFrame {
|
|||||||
errorMessage.setVisible(true);
|
errorMessage.setVisible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void hideError() { errorMessage.setVisible(false); }
|
protected void hideError() {
|
||||||
|
errorMessage.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
public JLayeredPane getView() {
|
public JLayeredPane getView() {
|
||||||
return view;
|
return view;
|
||||||
@ -318,19 +354,27 @@ public class LevelEditor extends JFrame {
|
|||||||
return mapLayersManager;
|
return mapLayersManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
public HashMap<String, Integer> getCellMap() { return cellMap; }
|
public HashMap<String, Integer> getCellMap() {
|
||||||
|
return cellMap;
|
||||||
|
}
|
||||||
|
|
||||||
public void setCellMap(HashMap<String, Integer> cellMap) {
|
public void setCellMap(HashMap<String, Integer> cellMap) {
|
||||||
this.cellMap = cellMap;
|
this.cellMap = cellMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[][] getCellArray() { return cellArray; }
|
public String[][] getCellArray() {
|
||||||
|
return cellArray;
|
||||||
|
}
|
||||||
|
|
||||||
public void setCellArray(String[][] cellArray) { this.cellArray = cellArray; }
|
public void setCellArray(String[][] cellArray) {
|
||||||
|
this.cellArray = cellArray;
|
||||||
|
}
|
||||||
|
|
||||||
public void setOverview(TilesetOverview overview) {
|
public void setOverview(TilesetOverview overview) {
|
||||||
this.overview = overview;
|
this.overview = overview;
|
||||||
}
|
}
|
||||||
|
|
||||||
public LevelEditor getEditor() { return this; }
|
public LevelEditor getEditor() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -91,6 +91,7 @@ public class MapLayersManager {
|
|||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
editor.getInfoManager().displayInfo(object, "object", x, y);
|
editor.getInfoManager().displayInfo(object, "object", x, y);
|
||||||
|
System.out.println("object");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
objectSet.add(object);
|
objectSet.add(object);
|
||||||
@ -138,7 +139,7 @@ public class MapLayersManager {
|
|||||||
for (int j = 0; j < height; j++) {
|
for (int j = 0; j < height; j++) {
|
||||||
JLabel tile = new JLabel();
|
JLabel tile = new JLabel();
|
||||||
if (imagesOfTiles == null || imagesOfTiles.size() == 0) {
|
if (imagesOfTiles == null || imagesOfTiles.size() == 0) {
|
||||||
tile.setText("<html><div style='text-align: center; width: 50'>" + String.valueOf(map.getImageCell().getMapBackground()[i][j]) + "</div></html>");
|
tile.setText("<html><div style='text-align: center; width: 50'>" + map.getImageCell().getMapBackground()[i][j] + "</div></html>");
|
||||||
tile.setHorizontalTextPosition(JLabel.CENTER);
|
tile.setHorizontalTextPosition(JLabel.CENTER);
|
||||||
tileSet.setOpaque(true);
|
tileSet.setOpaque(true);
|
||||||
tileSet.setBackground(Color.BLUE);
|
tileSet.setBackground(Color.BLUE);
|
||||||
@ -158,6 +159,7 @@ public class MapLayersManager {
|
|||||||
@Override
|
@Override
|
||||||
public void mouseClicked(MouseEvent e) {
|
public void mouseClicked(MouseEvent e) {
|
||||||
editor.getInfoManager().displayInfo(tile, "tile", x, y);
|
editor.getInfoManager().displayInfo(tile, "tile", x, y);
|
||||||
|
System.out.println("tile");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
tileSet.add(tile);
|
tileSet.add(tile);
|
||||||
|
|||||||
@ -64,6 +64,11 @@ public class TilesetOverview extends JFrame {
|
|||||||
setLocationRelativeTo(null);
|
setLocationRelativeTo(null);
|
||||||
setVisible(true);
|
setVisible(true);
|
||||||
setResizable(false);
|
setResizable(false);
|
||||||
|
try {
|
||||||
|
setIconImage(ImageIO.read(new File("src/main/resources/images/icon.png")).getScaledInstance(64, 64, Image.SCALE_DEFAULT));
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadTileset(String name) {
|
private void loadTileset(String name) {
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package ruscz.game.gameOfProd.Save;
|
package ruscz.game.gameOfProd.Save;
|
||||||
|
|
||||||
import ruscz.game.gameOfProd.Cells.ChestCell;
|
import ruscz.game.gameOfProd.Cells.ChestCell;
|
||||||
|
import ruscz.game.gameOfProd.Cells.DoorCell;
|
||||||
import ruscz.game.gameOfProd.Cells.Npc;
|
import ruscz.game.gameOfProd.Cells.Npc;
|
||||||
import ruscz.game.gameOfProd.Cells.TriggerCell;
|
import ruscz.game.gameOfProd.Cells.TriggerCell;
|
||||||
import ruscz.game.gameOfProd.Inventory.InventoryManager;
|
import ruscz.game.gameOfProd.Inventory.InventoryManager;
|
||||||
@ -154,6 +155,11 @@ public class LoadManager {
|
|||||||
ChestCell chestCell = map.findChestByXY(Integer.parseInt(getValue(scanner.nextLine())), Integer.parseInt(getValue(scanner.nextLine())));
|
ChestCell chestCell = map.findChestByXY(Integer.parseInt(getValue(scanner.nextLine())), Integer.parseInt(getValue(scanner.nextLine())));
|
||||||
chestCell.setActive(Boolean.parseBoolean(getValue(scanner.nextLine())));
|
chestCell.setActive(Boolean.parseBoolean(getValue(scanner.nextLine())));
|
||||||
}
|
}
|
||||||
|
else if (data.contains("<door>")) {
|
||||||
|
DoorCell doorCell = map.findDoorByXY(Integer.parseInt(getValue(scanner.nextLine())), Integer.parseInt(getValue(scanner.nextLine())));
|
||||||
|
doorCell.setLocked(Boolean.parseBoolean(getValue(scanner.nextLine())));
|
||||||
|
doorCell.setOpen(Boolean.parseBoolean(getValue(scanner.nextLine())));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
scanner.close();
|
scanner.close();
|
||||||
} catch (FileNotFoundException e) {
|
} catch (FileNotFoundException e) {
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package ruscz.game.gameOfProd.Save;
|
package ruscz.game.gameOfProd.Save;
|
||||||
|
|
||||||
import ruscz.game.gameOfProd.Cells.ChestCell;
|
import ruscz.game.gameOfProd.Cells.ChestCell;
|
||||||
|
import ruscz.game.gameOfProd.Cells.DoorCell;
|
||||||
import ruscz.game.gameOfProd.Cells.Person;
|
import ruscz.game.gameOfProd.Cells.Person;
|
||||||
import ruscz.game.gameOfProd.Cells.TriggerCell;
|
import ruscz.game.gameOfProd.Cells.TriggerCell;
|
||||||
import ruscz.game.gameOfProd.Inventory.InventoryManager;
|
import ruscz.game.gameOfProd.Inventory.InventoryManager;
|
||||||
@ -71,6 +72,16 @@ public class SaveManager {
|
|||||||
" </chest>" + System.lineSeparator();
|
" </chest>" + System.lineSeparator();
|
||||||
mapInfo += event;
|
mapInfo += event;
|
||||||
}
|
}
|
||||||
|
for (DoorCell doorCell : map.getDoorCells()) {
|
||||||
|
String event =
|
||||||
|
" <door>" + System.lineSeparator() +
|
||||||
|
" <x>" + doorCell.getX() + "</x>" + System.lineSeparator() +
|
||||||
|
" <y>" + doorCell.getY() + "</y>" + System.lineSeparator() +
|
||||||
|
" <locked>" + doorCell.isLocked() + "</locked>" + System.lineSeparator() +
|
||||||
|
" <open>" + doorCell.isOpen() + "</open>" + System.lineSeparator() +
|
||||||
|
" </dooŕ>" + System.lineSeparator();
|
||||||
|
mapInfo += event;
|
||||||
|
}
|
||||||
mapInfo +=
|
mapInfo +=
|
||||||
" </events>" + System.lineSeparator() +
|
" </events>" + System.lineSeparator() +
|
||||||
"</map>" + System.lineSeparator();
|
"</map>" + System.lineSeparator();
|
||||||
|
|||||||
@ -248,7 +248,7 @@ public class WindowOfBattle extends JPanel {
|
|||||||
|
|
||||||
public void addImage(String name) {
|
public void addImage(String name) {
|
||||||
try {
|
try {
|
||||||
images.add(ImageIO.read(new File("src/main/resources/foregrounds/" + name + ".png")));
|
images.add(ImageIO.read(new File("src/main/resources/images/" + name + ".png")));
|
||||||
image = images.getLast();
|
image = images.getLast();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
@ -257,7 +257,7 @@ public class WindowOfBattle extends JPanel {
|
|||||||
|
|
||||||
public void setImage(String name) {
|
public void setImage(String name) {
|
||||||
try {
|
try {
|
||||||
image = ImageIO.read(new File("src/main/resources/foregrounds/" + name + ".png"));
|
image = ImageIO.read(new File("src/main/resources/images/" + name + ".png"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -282,7 +282,7 @@ public class WindowOfFreeMove extends JLayeredPane {
|
|||||||
if (name == null) imageForeground = null;
|
if (name == null) imageForeground = null;
|
||||||
else {
|
else {
|
||||||
try {
|
try {
|
||||||
imageForeground = ImageIO.read(new File("src/main/resources/foregrounds/" + name + ".png"));
|
imageForeground = ImageIO.read(new File("src/main/resources/images/" + name + ".png"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@ -198,9 +198,11 @@ public class WindowOfMenu extends JPanel {
|
|||||||
if (!getIgnoreRepaint()) {
|
if (!getIgnoreRepaint()) {
|
||||||
Image powered = null;
|
Image powered = null;
|
||||||
Image menu = null;
|
Image menu = null;
|
||||||
|
Image logo = null;
|
||||||
try {
|
try {
|
||||||
powered = ImageIO.read(new File("src/main/resources/foregrounds/poweredByCellEngine.png"));
|
powered = ImageIO.read(new File("src/main/resources/images/poweredByCellEngine.png"));
|
||||||
menu = ImageIO.read(new File("src/main/resources/foregrounds/menu.png"));
|
menu = ImageIO.read(new File("src/main/resources/images/menu.png"));
|
||||||
|
logo = ImageIO.read(new File("src/main/resources/images/logo.png"));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@ -209,7 +211,11 @@ public class WindowOfMenu extends JPanel {
|
|||||||
if (!showMenu)
|
if (!showMenu)
|
||||||
g.drawImage(powered, (screenSize.width - (powered.getWidth(null) / 2)) / 2, (screenSize.height - (powered.getHeight(null) / 2)) / 2,
|
g.drawImage(powered, (screenSize.width - (powered.getWidth(null) / 2)) / 2, (screenSize.height - (powered.getHeight(null) / 2)) / 2,
|
||||||
(powered.getWidth(null) / 2), (powered.getHeight(null) / 2), null);
|
(powered.getWidth(null) / 2), (powered.getHeight(null) / 2), null);
|
||||||
else g.drawImage(menu, 0, 0, screenSize.width, screenSize.height, null);
|
else {
|
||||||
|
g.drawImage(menu, 0, 0, screenSize.width, screenSize.height, null);
|
||||||
|
g.drawImage(logo, (screenSize.width - (logo.getWidth(null) * 3)) / 2, 50,
|
||||||
|
logo.getWidth(null) * 3, logo.getHeight(null) * 3, null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
7 7 storageroom
|
10 9 storageroom
|
||||||
30 79 1 0 20 2 2
|
30 79 1 0 20 2.5 2.5
|
||||||
monster.png
|
monster.png
|
||||||
storageroombattle
|
storageroombattle
|
||||||
|
Before Width: | Height: | Size: 107 KiB After Width: | Height: | Size: 107 KiB |
|
Before Width: | Height: | Size: 120 KiB After Width: | Height: | Size: 120 KiB |
|
Before Width: | Height: | Size: 155 KiB After Width: | Height: | Size: 155 KiB |
|
Before Width: | Height: | Size: 156 KiB After Width: | Height: | Size: 156 KiB |
|
Before Width: | Height: | Size: 158 KiB After Width: | Height: | Size: 158 KiB |
|
Before Width: | Height: | Size: 202 KiB After Width: | Height: | Size: 202 KiB |
|
Before Width: | Height: | Size: 222 KiB After Width: | Height: | Size: 222 KiB |
BIN
src/main/resources/images/icon.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
BIN
src/main/resources/images/logo.png
Normal file
|
After Width: | Height: | Size: 4.3 KiB |
BIN
src/main/resources/images/logo2.png
Normal file
|
After Width: | Height: | Size: 4.0 KiB |
|
Before Width: | Height: | Size: 132 KiB After Width: | Height: | Size: 132 KiB |
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
@ -1,13 +1,13 @@
|
|||||||
0 0 0 0 0 0 0 0 0 0 0 0 0
|
0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
|
0 131 147 242 242 0 0 0 0 0 0 0 0
|
||||||
|
0 132 148 243 243 0 0 0 0 0 0 419 0
|
||||||
|
0 0 0 0 0 0 0 0 0 0 0 420 0
|
||||||
|
0 390 0 0 0 0 0 0 0 0 0 435 0
|
||||||
|
0 461 461 0 0 0 0 0 0 0 0 436 0
|
||||||
|
0 462 462 0 0 0 0 0 0 395 395 395 0
|
||||||
|
0 391 423 0 0 0 0 0 0 396 396 396 0
|
||||||
|
0 423 0 0 0 0 0 515 531 0 0 0 0
|
||||||
|
0 0 0 0 0 0 0 516 532 397 413 429 0
|
||||||
|
0 821 0 0 0 0 0 0 0 398 414 430 0
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0
|
0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0
|
0 0 0 7 7 7 0 7 7 7 0 0 0
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
||||||
0 0 0 0 0 0 0 0 0 0 0 0 0
|
|
||||||
@ -12,8 +12,8 @@
|
|||||||
0 0 0 0 0 0 0 0 0 0 0 0 0
|
0 0 0 0 0 0 0 0 0 0 0 0 0
|
||||||
6 6 6 6 6 6 6 6 6 6 6 6 6
|
6 6 6 6 6 6 6 6 6 6 6 6 6
|
||||||
6 6 6 6 6 6 6 6 6 6 6 6 6
|
6 6 6 6 6 6 6 6 6 6 6 6 6
|
||||||
6 6 6 6 6 6 6 6 6 6 6 6 6
|
6 379 6 6 6 6 6 6 6 6 6 6 6
|
||||||
6 6 6 6 6 6 6 6 6 6 6 6 6
|
6 6 378 6 6 6 6 379 6 6 6 6 6
|
||||||
6 6 6 6 6 6 6 6 6 6 6 6 6
|
6 6 6 6 6 6 6 6 6 6 6 6 6
|
||||||
6 6 6 6 6 6 6 6 6 6 6 6 6
|
6 6 6 6 6 6 6 6 6 6 6 6 6
|
||||||
6 6 6 6 6 6 6 6 6 6 6 6 6
|
6 6 6 6 6 6 6 6 6 6 6 6 6
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
13 13
|
13 13
|
||||||
BLOCK,d BLOCK,d BLOCK,d BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d BLOCK,d BLOCK,d BLOCK,d
|
BLOCK,d BLOCK,d BLOCK,d BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d BLOCK,d BLOCK,d BLOCK,d
|
||||||
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK DOORTO,true,4,3,office BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK
|
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK DOORTO,true,4,3,office BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK
|
||||||
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY TRIGGER,cutscene-fight EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
BLOCK block block block block EMPTY TRIGGER,cutscene-fight EMPTY EMPTY EMPTY EMPTY block BLOCK
|
||||||
|
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block BLOCK
|
||||||
|
BLOCK block EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block BLOCK
|
||||||
|
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block BLOCK
|
||||||
|
BLOCK block block EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
||||||
|
BLOCK block block EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block block block BLOCK
|
||||||
|
BLOCK block EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
||||||
|
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block block EMPTY block EMPTY BLOCK
|
||||||
|
BLOCK block EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block block block BLOCK
|
||||||
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
||||||
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
BLOCK BLOCK BLOCK block block block BLOCK block block block BLOCK BLOCK BLOCK
|
||||||
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
|
||||||
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
|
||||||
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
|
||||||
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
|
||||||
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
|
||||||
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
|
||||||
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
|
|
||||||
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK
|
|
||||||
@ -14,7 +14,7 @@
|
|||||||
<trigger>
|
<trigger>
|
||||||
<x>6</x>
|
<x>6</x>
|
||||||
<y>4</y>
|
<y>4</y>
|
||||||
<active>false</active>
|
<active>true</active>
|
||||||
</trigger>
|
</trigger>
|
||||||
<trigger>
|
<trigger>
|
||||||
<x>14</x>
|
<x>14</x>
|
||||||
@ -24,13 +24,43 @@
|
|||||||
<chest>
|
<chest>
|
||||||
<x>1</x>
|
<x>1</x>
|
||||||
<y>2</y>
|
<y>2</y>
|
||||||
<active>false</active>
|
<active>true</active>
|
||||||
</chest>
|
</chest>
|
||||||
<chest>
|
<chest>
|
||||||
<x>15</x>
|
<x>15</x>
|
||||||
<y>7</y>
|
<y>7</y>
|
||||||
<active>true</active>
|
<active>true</active>
|
||||||
</chest>
|
</chest>
|
||||||
|
<door>
|
||||||
|
<x>8</x>
|
||||||
|
<y>4</y>
|
||||||
|
<locked>false</locked>
|
||||||
|
<open>false</open>
|
||||||
|
</dooŕ>
|
||||||
|
<door>
|
||||||
|
<x>2</x>
|
||||||
|
<y>6</y>
|
||||||
|
<locked>true</locked>
|
||||||
|
<open>false</open>
|
||||||
|
</dooŕ>
|
||||||
|
<door>
|
||||||
|
<x>6</x>
|
||||||
|
<y>6</y>
|
||||||
|
<locked>false</locked>
|
||||||
|
<open>false</open>
|
||||||
|
</dooŕ>
|
||||||
|
<door>
|
||||||
|
<x>16</x>
|
||||||
|
<y>10</y>
|
||||||
|
<locked>false</locked>
|
||||||
|
<open>false</open>
|
||||||
|
</dooŕ>
|
||||||
|
<door>
|
||||||
|
<x>8</x>
|
||||||
|
<y>13</y>
|
||||||
|
<locked>false</locked>
|
||||||
|
<open>true</open>
|
||||||
|
</dooŕ>
|
||||||
</events>
|
</events>
|
||||||
</map>
|
</map>
|
||||||
<map>
|
<map>
|
||||||
@ -44,8 +74,50 @@
|
|||||||
<chest>
|
<chest>
|
||||||
<x>1</x>
|
<x>1</x>
|
||||||
<y>9</y>
|
<y>9</y>
|
||||||
<active>true</active>
|
<active>false</active>
|
||||||
</chest>
|
</chest>
|
||||||
|
<door>
|
||||||
|
<x>12</x>
|
||||||
|
<y>1</y>
|
||||||
|
<locked>true</locked>
|
||||||
|
<open>false</open>
|
||||||
|
</dooŕ>
|
||||||
|
<door>
|
||||||
|
<x>17</x>
|
||||||
|
<y>1</y>
|
||||||
|
<locked>true</locked>
|
||||||
|
<open>false</open>
|
||||||
|
</dooŕ>
|
||||||
|
<door>
|
||||||
|
<x>7</x>
|
||||||
|
<y>12</y>
|
||||||
|
<locked>true</locked>
|
||||||
|
<open>false</open>
|
||||||
|
</dooŕ>
|
||||||
|
<door>
|
||||||
|
<x>12</x>
|
||||||
|
<y>12</y>
|
||||||
|
<locked>true</locked>
|
||||||
|
<open>false</open>
|
||||||
|
</dooŕ>
|
||||||
|
<door>
|
||||||
|
<x>4</x>
|
||||||
|
<y>1</y>
|
||||||
|
<locked>false</locked>
|
||||||
|
<open>false</open>
|
||||||
|
</dooŕ>
|
||||||
|
<door>
|
||||||
|
<x>2</x>
|
||||||
|
<y>12</y>
|
||||||
|
<locked>false</locked>
|
||||||
|
<open>false</open>
|
||||||
|
</dooŕ>
|
||||||
|
<door>
|
||||||
|
<x>17</x>
|
||||||
|
<y>12</y>
|
||||||
|
<locked>true</locked>
|
||||||
|
<open>false</open>
|
||||||
|
</dooŕ>
|
||||||
</events>
|
</events>
|
||||||
</map>
|
</map>
|
||||||
<map>
|
<map>
|
||||||
@ -56,6 +128,12 @@
|
|||||||
<y>18</y>
|
<y>18</y>
|
||||||
<active>true</active>
|
<active>true</active>
|
||||||
</trigger>
|
</trigger>
|
||||||
|
<door>
|
||||||
|
<x>4</x>
|
||||||
|
<y>19</y>
|
||||||
|
<locked>false</locked>
|
||||||
|
<open>false</open>
|
||||||
|
</dooŕ>
|
||||||
</events>
|
</events>
|
||||||
</map>
|
</map>
|
||||||
<map>
|
<map>
|
||||||
@ -76,5 +154,11 @@
|
|||||||
<y>2</y>
|
<y>2</y>
|
||||||
<active>true</active>
|
<active>true</active>
|
||||||
</trigger>
|
</trigger>
|
||||||
|
<door>
|
||||||
|
<x>6</x>
|
||||||
|
<y>1</y>
|
||||||
|
<locked>false</locked>
|
||||||
|
<open>false</open>
|
||||||
|
</dooŕ>
|
||||||
</events>
|
</events>
|
||||||
</map>
|
</map>
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
<item>
|
|
||||||
<name>cup-o'-coffee</name>
|
|
||||||
<multiplicity>1</multiplicity>
|
|
||||||
<image>295</image>
|
|
||||||
<action>heal</action>
|
|
||||||
</item>
|
|
||||||
@ -1,6 +1,6 @@
|
|||||||
<location>
|
<location>
|
||||||
<map>storageroom</map>
|
<map>openspace</map>
|
||||||
<x>6</x>
|
<x>8</x>
|
||||||
<y>2</y>
|
<y>15</y>
|
||||||
<direction>0</direction>
|
<direction>3</direction>
|
||||||
</location>
|
</location>
|
||||||
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 21 KiB |
|
Before Width: | Height: | Size: 51 KiB After Width: | Height: | Size: 53 KiB |
|
Before Width: | Height: | Size: 65 KiB After Width: | Height: | Size: 65 KiB |
@ -126,7 +126,10 @@ public class LevelEditorTest {
|
|||||||
scanner.nextLine();
|
scanner.nextLine();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
while (scanner.hasNextLine()) {
|
while (scanner.hasNextLine()) {
|
||||||
cellArray[i] = scanner.nextLine().split(" ");
|
String[] data = scanner.nextLine().split(" ");
|
||||||
|
for (int j = 0; j < data.length; j++) {
|
||||||
|
cellArray[j][i] = data[j];
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
levelEditor.setCellArray(cellArray);
|
levelEditor.setCellArray(cellArray);
|
||||||
|
|||||||