improved map loading and custcene loading

This commit is contained in:
musilto9 2020-04-24 14:38:46 +02:00
parent 489ddd6f28
commit 3f39e8b183
50 changed files with 219 additions and 186 deletions

View File

@ -1,6 +1,7 @@
package ruscz.game.gameOfProd.Cells; package ruscz.game.gameOfProd.Cells;
import ruscz.game.gameOfProd.Image.ImageCell; import ruscz.game.gameOfProd.Image.ImageCell;
import ruscz.game.gameOfProd.Map.Map;
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove; import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
import java.awt.*; import java.awt.*;
@ -10,16 +11,16 @@ public class Block extends Cell {
private boolean paint; private boolean paint;
private String partial; private String partial;
public Block(int x, int y, ImageCell imageCell, boolean paint) { public Block(int x, int y, Map map, boolean paint) {
super(x, y, WindowOfFreeMove.CELL_SIZE, Color.BLUE); super(x, y, WindowOfFreeMove.CELL_SIZE, Color.BLUE);
this.imageCell = imageCell; this.imageCell = map.getImageCell();
this.paint = paint; this.paint = paint;
this.partial = ""; this.partial = "";
} }
public Block(int x, int y, ImageCell imageCell, String partial, boolean paint) { public Block(int x, int y, Map map, String partial, boolean paint) {
super(x, y, WindowOfFreeMove.CELL_SIZE, Color.BLUE); super(x, y, WindowOfFreeMove.CELL_SIZE, Color.BLUE);
this.imageCell = imageCell; this.imageCell = map.getImageCell();
this.partial = partial; this.partial = partial;
this.paint = paint; this.paint = paint;
} }

View File

@ -1,9 +1,9 @@
package ruscz.game.gameOfProd.Cells; package ruscz.game.gameOfProd.Cells;
import ruscz.game.gameOfProd.Dialog.Dialog; import ruscz.game.gameOfProd.Dialog.Dialog;
import ruscz.game.gameOfProd.Image.ImageCell;
import ruscz.game.gameOfProd.Inventory.InventoryManager; import ruscz.game.gameOfProd.Inventory.InventoryManager;
import ruscz.game.gameOfProd.Inventory.Item; import ruscz.game.gameOfProd.Inventory.Item;
import ruscz.game.gameOfProd.Map.Map;
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove; import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
import java.awt.*; import java.awt.*;
@ -17,16 +17,16 @@ public class ChestCell extends InteractionCell {
private boolean showItem; private boolean showItem;
private boolean isActive; private boolean isActive;
public ChestCell(int x, int y, String inventory, Dialog dialog, ImageCell imageCell, WindowOfFreeMove window, boolean paint) { public ChestCell(int x, int y, String inventory, Dialog dialog, Map map, WindowOfFreeMove window, boolean paint) {
super(x, y, null, dialog, imageCell, window, paint); super(x, y, null, dialog, map, window, paint);
this.showItem = false; this.showItem = false;
this.chestInventory = new LinkedList<>(); this.chestInventory = new LinkedList<>();
this.isActive = true; this.isActive = true;
fillChest(inventory); fillChest(inventory);
} }
public ChestCell(int x, int y, String inventory, Dialog dialog, ImageCell imageCell, WindowOfFreeMove window) { public ChestCell(int x, int y, String inventory, Dialog dialog, Map map, WindowOfFreeMove window) {
super(x, y, null, dialog, imageCell, window, false); super(x, y, null, dialog, map, window, false);
this.showItem = true; this.showItem = true;
this.chestInventory = new LinkedList<>(); this.chestInventory = new LinkedList<>();
this.isActive = true; this.isActive = true;

View File

@ -1,8 +1,8 @@
package ruscz.game.gameOfProd.Cells; package ruscz.game.gameOfProd.Cells;
import ruscz.game.gameOfProd.Dialog.Dialog; import ruscz.game.gameOfProd.Dialog.Dialog;
import ruscz.game.gameOfProd.Image.ImageCell;
import ruscz.game.gameOfProd.Inventory.Item; import ruscz.game.gameOfProd.Inventory.Item;
import ruscz.game.gameOfProd.Map.Map;
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove; import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
import java.awt.*; import java.awt.*;
@ -12,18 +12,21 @@ public class DoorCell extends InteractionCell {
private boolean isLocked; private boolean isLocked;
private boolean directionVert; private boolean directionVert;
private String sound; private String sound;
private String soundOpen;
private String soundClose;
private String soundLocked;
private float volume; private float volume;
public DoorCell(int x, int y, boolean directionVert, String message, Dialog dialog, ImageCell imageCell, WindowOfFreeMove window) { public DoorCell(int x, int y, boolean directionVert, String message, Dialog dialog, Map map, WindowOfFreeMove window) {
super(x, y, message, dialog, imageCell, window, true); super(x, y, message, dialog, map, window, true);
this.isOpen = false; this.isOpen = false;
this.isLocked = true; this.isLocked = true;
this.directionVert = directionVert; this.directionVert = directionVert;
setSound(); setSound();
} }
public DoorCell(int x, int y, boolean directionVert, ImageCell imageCell, WindowOfFreeMove window) { public DoorCell(int x, int y, boolean directionVert, Map map, WindowOfFreeMove window) {
super(x, y, null, null, imageCell, window, true); super(x, y, null, null, map, window, true);
this.isOpen = false; this.isOpen = false;
this.isLocked = false; this.isLocked = false;
this.directionVert = directionVert; this.directionVert = directionVert;
@ -47,19 +50,31 @@ public class DoorCell extends InteractionCell {
private void setSound() { private void setSound() {
if (isOpen) { if (isOpen) {
sound = "qubodup-DoorOpen01-changed.wav"; sound = super.getSoundManager().getSoundMap().get("doorOpen");
volume = -8.0f; volume = -8.0f;
} }
else if (!isOpen && !isLocked) { else if (!isOpen && !isLocked) {
sound = "qubodup-DoorClose02-changed.wav"; sound = super.getSoundManager().getSoundMap().get("doorClose");
volume = -8.0f; volume = -8.0f;
} }
else if (isLocked) { else if (isLocked) {
sound = "doorLocked.wav"; sound = super.getSoundManager().getSoundMap().get("doorLocked");
volume = -10.0f; volume = -10.0f;
} }
} }
// public void setSoundOpen(String soundOpen) {
// this.soundOpen = soundOpen;
// }
//
// public void setSoundClose(String soundClose) {
// this.soundClose = soundClose;
// }
//
// public void setSoundLocked(String soundLocked) {
// this.soundLocked = soundLocked;
// }
public boolean isOpen() { public boolean isOpen() {
return isOpen; return isOpen;
} }

View File

@ -6,6 +6,7 @@ import ruscz.game.gameOfProd.Image.ImageDialog;
import ruscz.game.gameOfProd.Inventory.InventoryManager; import ruscz.game.gameOfProd.Inventory.InventoryManager;
import ruscz.game.gameOfProd.Inventory.Item; import ruscz.game.gameOfProd.Inventory.Item;
import ruscz.game.gameOfProd.Map.Map; import ruscz.game.gameOfProd.Map.Map;
import ruscz.game.gameOfProd.Sounds.SoundManager;
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove; import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
import javax.swing.*; import javax.swing.*;
@ -19,29 +20,31 @@ public class InteractionCell extends Cell {
protected ruscz.game.gameOfProd.Dialog.Dialog dialog; protected ruscz.game.gameOfProd.Dialog.Dialog dialog;
protected Scanner scanner; protected Scanner scanner;
private ImageCell imageCell; private ImageCell imageCell;
private SoundManager soundManager;
private WindowOfFreeMove window; private WindowOfFreeMove window;
protected boolean paint; protected boolean paint;
private Timer timer; private Timer timer;
public InteractionCell(int x, int y, String message, Dialog dialog, ImageCell imageCell, WindowOfFreeMove window, boolean paint) { public InteractionCell(int x, int y, String message, Dialog dialog, Map map, WindowOfFreeMove window, boolean paint) {
super(x, y, WindowOfFreeMove.CELL_SIZE, Color.ORANGE); super(x, y, WindowOfFreeMove.CELL_SIZE, Color.ORANGE);
this.message = message; this.message = message;
this.dialog = dialog; this.dialog = dialog;
this.imageCell = imageCell; this.imageCell = map.getImageCell();
this.soundManager = map.getSoundManager();
this.window = window; this.window = window;
this.paint = paint; this.paint = paint;
} }
public void startEvent() { public void startEvent() {
if (message != null) { if (message != null) {
if (message.equals("error")) { if (message.contains("cutscene")) {
final int[] i = {0}; final int[] i = {0};
timer = new Timer(1000, actionEvent -> { timer = new Timer(1000, actionEvent -> {
errorEvent(i[0] +1); playCustscene(message,i[0] +1);
i[0]++; i[0]++;
}); });
timer.start(); timer.start();
readDialogFile(message); readDialogFile("empty");
} }
else { else {
window.setCanPersonMove(false); window.setCanPersonMove(false);
@ -203,41 +206,50 @@ public class InteractionCell extends Cell {
} }
} }
private void errorEvent(int i) { public void playCustscene(String name, int i) {
if (i == 1) { try {
WindowOfFreeMove.setCanPersonMove(false); File cutsceneFile = new File("src/main/resources/dialogs/cutscenes/" + name + ".txt");
window.getForegroundPanel().setImageForeground("error"); scanner = new Scanner(cutsceneFile);
while (scanner.hasNextLine()) {
String[] data = scanner.nextLine().split(" ");
if (data[0].contains("<" + i + ">")) {
if (data[1].contains("<text>")) {
if (data[2].equals("null")) dialog.hideText();
else {
dialog.setText(data[2].replaceAll("-", " "));
dialog.showText();
}
}
else if (data[1].contains("<foreground>")) {
if (data[2].equals("null")) window.getForegroundPanel().setVisible(false);
else {
window.getForegroundPanel().setImageForeground(data[2]);
window.getForegroundPanel().setVisible(true); window.getForegroundPanel().setVisible(true);
window.repaintCanvas();
} }
else if (i == 3) {
Map openspace = Map.findMapByName("openspace", window);
window.getMapManager().setMap(openspace);
openspace.getPerson().set(openspace.getSpawnPoint()[0], openspace.getSpawnPoint()[1]);
openspace.getPerson().setDirectionSight(4);
openspace.setIdExit(0);
dialog.hideText();
dialog.setText("Shit..");
dialog.showText();
} }
else if (i == 5) { else if (data[1].contains("<personmove")) {
window.getForegroundPanel().setVisible(false); WindowOfFreeMove.setCanPersonMove(Boolean.parseBoolean(data[2]));
dialog.hideText();
} }
else if (i == 6) { else if (data[1].contains("<moveto>")) {
dialog.setText("I have to take a break. It's lunch time anyway."); Map map = Map.findMapByName(data[2], window);
dialog.showText(); window.getMapManager().setMap(map);
map.getPerson().set(map.getSpawnPoint()[0], map.getSpawnPoint()[1]);
map.getPerson().setDirectionSight(Integer.parseInt(data[3]));
map.setIdExit(0);
} }
else if (i == 10) { else if (data[1].equals("<music>")) {
dialog.hideText();
WindowOfFreeMove.setCanPersonMove(true);
}
else if (i == 11) {
window.getMusicManager().playMusic(); window.getMusicManager().playMusic();
window.getMusicManager().fadeIn(10); window.getMusicManager().fadeIn(10);
}
else if (data[1].equals("<end>")) {
timer.stop(); timer.stop();
} }
} }
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public void useItem(Item item) { public void useItem(Item item) {
InventoryManager.removeItem(item); InventoryManager.removeItem(item);
@ -254,4 +266,6 @@ public class InteractionCell extends Cell {
public ImageCell getImageCell() { public ImageCell getImageCell() {
return imageCell; return imageCell;
} }
public SoundManager getSoundManager() { return soundManager; }
} }

View File

@ -1,7 +1,7 @@
package ruscz.game.gameOfProd.Cells; package ruscz.game.gameOfProd.Cells;
import ruscz.game.gameOfProd.Dialog.Dialog; import ruscz.game.gameOfProd.Dialog.Dialog;
import ruscz.game.gameOfProd.Image.ImageCell; import ruscz.game.gameOfProd.Map.Map;
import ruscz.game.gameOfProd.Windows.WindowOfFreeMove; import ruscz.game.gameOfProd.Windows.WindowOfFreeMove;
import java.awt.*; import java.awt.*;
@ -9,8 +9,8 @@ import java.awt.*;
public class TriggerCell extends InteractionCell { public class TriggerCell extends InteractionCell {
private boolean isActive; private boolean isActive;
public TriggerCell(int x, int y, String message, Dialog dialog, ImageCell imageCell, WindowOfFreeMove window) { public TriggerCell(int x, int y, String message, Dialog dialog, Map map, WindowOfFreeMove window) {
super(x, y, message, dialog, imageCell, window, false); super(x, y, message, dialog, map, window, false);
this.isActive = true; this.isActive = true;
} }

View File

@ -38,7 +38,11 @@ public class ImageCell {
String[] mapInfo = data.split(" "); String[] mapInfo = data.split(" ");
imageItem(mapInfo); imageItem(mapInfo);
} }
else { else if (data.contains("<cellmap>")) {
String[] mapInfo = data.split(" ");
loadCellMap(mapInfo);
}
else if (!data.contains("<soundmap>")) {
String[] mapColumn = data.split(" "); String[] mapColumn = data.split(" ");
for (int i = 0; i < mapColumn.length; i++) { for (int i = 0; i < mapColumn.length; i++) {
mapBackground[i][j] = Integer.parseInt(mapColumn[i]); mapBackground[i][j] = Integer.parseInt(mapColumn[i]);
@ -46,7 +50,6 @@ public class ImageCell {
j++; j++;
} }
} }
loadCellMap(name);
imageObjectset(name); imageObjectset(name);
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
System.out.println("An error occurred."); System.out.println("An error occurred.");
@ -103,15 +106,11 @@ public class ImageCell {
} }
} }
public void loadCellMap(String file) { public void loadCellMap(String[] cellInfo) {
try { if (cellMap == null)
File mapFile = new File("src/main/resources/maps/" + file + "-cellmap.txt");
Scanner scanner = new Scanner(mapFile);
cellMap = new HashMap<String, Integer>(); cellMap = new HashMap<String, Integer>();
while (scanner.hasNextLine()) {
String data = scanner.nextLine(); if (cellInfo[1].equals("DOOR")) {
String[] cellInfo = data.split(" ");
if (cellInfo[0].equals("DOOR")) {
Rectangle[] rec = new Rectangle[12]; Rectangle[] rec = new Rectangle[12];
int CELL_SIZE = WindowOfFreeMove.CELL_SIZE; int CELL_SIZE = WindowOfFreeMove.CELL_SIZE;
int count = 0; int count = 0;
@ -121,14 +120,10 @@ public class ImageCell {
count++; count++;
} }
} }
imageDoor = new ImageDoor(cellInfo[1], rec); imageDoor = new ImageDoor(cellInfo[2], rec);
} }
else else
cellMap.put(cellInfo[0], Integer.parseInt(cellInfo[1])); cellMap.put(cellInfo[1], Integer.parseInt(cellInfo[2]));
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
} }
public void imageItem(String[] itemInfo) { public void imageItem(String[] itemInfo) {

View File

@ -56,8 +56,8 @@ public class Map {
public static Map loadMapFromFile(String name, WindowOfFreeMove window) { public static Map loadMapFromFile(String name, WindowOfFreeMove window) {
try { try {
File dialogFile = new File("src/main/resources/maps/" + name + ".txt"); File file = new File("src/main/resources/maps/" + name + ".txt");
scanner = new Scanner(dialogFile); scanner = new Scanner(file);
String firstLine = scanner.nextLine(); String firstLine = scanner.nextLine();
String[] size = firstLine.split(" "); String[] size = firstLine.split(" ");
TypeOfCell[][] mapArray = new TypeOfCell[Integer.parseInt(size[0])][Integer.parseInt(size[1])]; TypeOfCell[][] mapArray = new TypeOfCell[Integer.parseInt(size[0])][Integer.parseInt(size[1])];
@ -65,6 +65,7 @@ public class Map {
map.setName(name); map.setName(name);
map.npcs = new LinkedList<>(); map.npcs = new LinkedList<>();
map.getImageCell().readMapFile(name); map.getImageCell().readMapFile(name);
map.getSoundManager().loadSoundMap(name);
map.canvasSize[0] = Integer.parseInt(size[0]); map.canvasSize[0] = Integer.parseInt(size[0]);
map.canvasSize[1] = Integer.parseInt(size[1]); map.canvasSize[1] = Integer.parseInt(size[1]);
int y = 0; int y = 0;
@ -90,13 +91,13 @@ public class Map {
String[] block = line[x].split(","); String[] block = line[x].split(",");
if (block[0].equals("BLOCK")) if (block[0].equals("BLOCK"))
if (block.length == 2) { if (block.length == 2) {
map.getBlocks().add(new Block(x, y, map.getImageCell(), block[1], true)); map.getBlocks().add(new Block(x, y, map, block[1], true));
} }
else { else {
map.getBlocks().add(new Block(x, y, map.getImageCell(), true)); map.getBlocks().add(new Block(x, y, map, true));
} }
else { else {
map.getBlocks().add(new Block(x, y, map.getImageCell(), false)); map.getBlocks().add(new Block(x, y, map, false));
} }
} else if (line[x].equals("EMPTY")) { } else if (line[x].equals("EMPTY")) {
cellType = TypeOfCell.EMPTY; cellType = TypeOfCell.EMPTY;
@ -104,27 +105,27 @@ public class Map {
} else if (line[x].contains("INTER") || line[x].contains("inter")) { } else if (line[x].contains("INTER") || line[x].contains("inter")) {
String[] event = line[x].split(","); String[] event = line[x].split(",");
if (line[x].contains("INTER")) if (line[x].contains("INTER"))
map.addInteractionEvent(new InteractionCell(x, y, event[1], new Dialog(window.getDialogBar()), map.getImageCell(), window, true)); map.addInteractionEvent(new InteractionCell(x, y, event[1], new Dialog(window.getDialogBar()), map, window, true));
else else
map.addInteractionEvent(new InteractionCell(x, y, event[1], new Dialog(window.getDialogBar()), map.getImageCell(), window, false)); map.addInteractionEvent(new InteractionCell(x, y, event[1], new Dialog(window.getDialogBar()), map, window, false));
} else if (line[x].contains("TRIGGER")) { } else if (line[x].contains("TRIGGER")) {
String[] trigger = line[x].split(","); String[] trigger = line[x].split(",");
map.addInteractionEvent(new TriggerCell(x, y, trigger[1], new Dialog(window.getDialogBar()), map.getImageCell(), window)); map.addInteractionEvent(new TriggerCell(x, y, trigger[1], new Dialog(window.getDialogBar()), map, window));
} else if (line[x].equals("SPAWN")) { } else if (line[x].equals("SPAWN")) {
map.setIdExit(0); map.setIdExit(0);
map.setSpawnPoint(x, y); map.setSpawnPoint(x, y);
} else if (line[x].contains("DOOR") && !line[x].contains("DOORTO")) { } else if (line[x].contains("DOOR") && !line[x].contains("DOORTO")) {
String[] door = line[x].split(","); String[] door = line[x].split(",");
if (door.length == 2) if (door.length == 2)
map.addInteractionEvent(new DoorCell(x, y, Boolean.parseBoolean(door[1]), map.getImageCell(), window)); map.addInteractionEvent(new DoorCell(x, y, Boolean.parseBoolean(door[1]), map, window));
else else
map.addInteractionEvent(new DoorCell(x, y, Boolean.parseBoolean(door[1]), door[2], new Dialog(window.getDialogBar()), map.getImageCell(), window)); map.addInteractionEvent(new DoorCell(x, y, Boolean.parseBoolean(door[1]), door[2], new Dialog(window.getDialogBar()), map, window));
} else if (line[x].contains("CHEST")) { } else if (line[x].contains("CHEST")) {
String[] chest = line[x].split(","); String[] chest = line[x].split(",");
if (chest.length == 3) if (chest.length == 3)
map.addInteractionEvent(new ChestCell(x, y, chest[1], new Dialog(window.getDialogBar()), map.getImageCell(), window, Boolean.parseBoolean(chest[2]))); map.addInteractionEvent(new ChestCell(x, y, chest[1], new Dialog(window.getDialogBar()), map, window, Boolean.parseBoolean(chest[2])));
else else
map.addInteractionEvent(new ChestCell(x, y, chest[1], new Dialog(window.getDialogBar()), map.getImageCell(), window)); map.addInteractionEvent(new ChestCell(x, y, chest[1], new Dialog(window.getDialogBar()), map, window));
} }
} }
} }
@ -151,11 +152,11 @@ public class Map {
else if (line[x].contains("DOORTO")) { else if (line[x].contains("DOORTO")) {
String[] doorTo = line[x].split(","); String[] doorTo = line[x].split(",");
if (doorTo[1].equals("locked")) { if (doorTo[1].equals("locked")) {
map.addInteractionEvent(new DoorCell(x, y, Boolean.parseBoolean(doorTo[2]), doorTo[3], new Dialog(window.getDialogBar()), map.getImageCell(), window)); map.addInteractionEvent(new DoorCell(x, y, Boolean.parseBoolean(doorTo[2]), doorTo[3], new Dialog(window.getDialogBar()), map, window));
map.addMoveToEvent(new EventMoveToCell(Integer.parseInt(doorTo[4]), Integer.parseInt(doorTo[5]), x, y, findMapByName(doorTo[6], window), window, false)); map.addMoveToEvent(new EventMoveToCell(Integer.parseInt(doorTo[4]), Integer.parseInt(doorTo[5]), x, y, findMapByName(doorTo[6], window), window, false));
} }
else { else {
map.addInteractionEvent(new DoorCell(x, y, Boolean.parseBoolean(doorTo[1]), map.getImageCell(), window)); map.addInteractionEvent(new DoorCell(x, y, Boolean.parseBoolean(doorTo[1]), map, window));
map.addMoveToEvent(new EventMoveToCell(Integer.parseInt(doorTo[2]), Integer.parseInt(doorTo[3]), x, y, findMapByName(doorTo[4], window), window, false)); map.addMoveToEvent(new EventMoveToCell(Integer.parseInt(doorTo[2]), Integer.parseInt(doorTo[3]), x, y, findMapByName(doorTo[4], window), window, false));
} }
} }

View File

@ -55,7 +55,7 @@ public class MapManager {
for (int i = 0; i < actualMap.getMapArray().length; i++) { for (int i = 0; i < actualMap.getMapArray().length; i++) {
for (int j = 0; j < actualMap.getMapArray()[0].length; j++) { for (int j = 0; j < actualMap.getMapArray()[0].length; j++) {
if (actualMap.getMapArray()[i][j] == TypeOfCell.BLOCK && !actualMap.isBusyCell(i, j)) { if (actualMap.getMapArray()[i][j] == TypeOfCell.BLOCK && !actualMap.isBusyCell(i, j)) {
actualMap.getBlocks().add(new Block(i, j, actualMap.getImageCell(), true)); actualMap.getBlocks().add(new Block(i, j, actualMap, true));
} }
if (actualMap.getMapArray()[i][j] == TypeOfCell.SPAWNPOINT && actualMap.getIdExit() == 0) { if (actualMap.getMapArray()[i][j] == TypeOfCell.SPAWNPOINT && actualMap.getIdExit() == 0) {

View File

@ -2,17 +2,44 @@ package ruscz.game.gameOfProd.Sounds;
import javax.sound.sampled.*; import javax.sound.sampled.*;
import java.io.File; import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.util.HashMap;
import java.util.Scanner;
public class SoundManager { public class SoundManager {
private FloatControl gainControl; private FloatControl gainControl;
private Clip clip; private Clip clip;
private int delay; private int delay;
private HashMap<String, String> soundMap;
public SoundManager() { public SoundManager() {
this.delay = 0; this.delay = 0;
} }
public void loadSoundMap(String file) {
try {
File mapFile = new File("src/main/resources/maps/" + file + "-tileset.txt");
Scanner scanner = new Scanner(mapFile);
soundMap = new HashMap<>();
while (scanner.hasNextLine()) {
String[] data = scanner.nextLine().split(" ");
if (data[0].equals("<soundmap>")) {
if (data[1].equals("DOOR")) {
soundMap.put("doorOpen", data[2]);
soundMap.put("doorClose", data[3]);
soundMap.put("doorLocked", data[4]);
}
else if (data[1].contains("WALK")) {
soundMap.put("walk", data[2]);
}
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
public void playSound(String name, float volume){ public void playSound(String name, float volume){
AudioInputStream audioIn; AudioInputStream audioIn;
try { try {
@ -46,8 +73,17 @@ public class SoundManager {
} }
this.delay = 0; this.delay = 0;
} }
else if (this.delay == delay-1) {
if (clip != null) {
clip.stop();
clip.flush();
}
this.delay++;
}
else { else {
this.delay++; this.delay++;
} }
} }
public HashMap<String, String> getSoundMap() { return soundMap; }
} }

View File

@ -0,0 +1,11 @@
<1> <personmove> false
<1> <foreground> error
<3> <moveto> openspace 4
<3> <text> Shit..
<5> <foreground> null
<5> <text> null
<6> <text> I-have-to-take-a-break.-It's-lunch-time-anyway.
<10> <text> null
<10> <personmove> true
<11> <music>
<11> <end>

View File

@ -0,0 +1,2 @@
<sound> horn.wav -15.0f
<end>

View File

@ -1,5 +0,0 @@
BLOCK 2
MOVETO 1
EVENT 3
TRIGGER 4
DOOR dark-door.png,32

View File

@ -2,6 +2,12 @@
<tileset> Openspace1.png 512 512 32 <tileset> Openspace1.png 512 512 32
<tileset> Openspace2.png 512 512 32 <tileset> Openspace2.png 512 512 32
<tileset> D_Inside_House.png 512 512 32 <tileset> D_Inside_House.png 512 512 32
<cellmap> BLOCK 2
<cellmap> MOVETO 1
<cellmap> EVENT 0
<cellmap> TRIGGER 4
<cellmap> DOOR dark-door.png,32
<soundmap> DOOR qubodup-DoorOpen01-changed.wav qubodup-DoorClose02-changed.wav doorLocked.wav
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 22 38 54 6 6 6 6 6 6 22 38 54 6 6 6

View File

@ -1,6 +0,0 @@
BLOCK 2
MOVETO 1
EVENT 3
TRIGGER 4
DOOR dark-door.png,32
CHEST 390

View File

@ -2,6 +2,13 @@
<tileset> Openspace1.png 512 512 32 <tileset> Openspace1.png 512 512 32
<tileset> Openspace2.png 512 512 32 <tileset> Openspace2.png 512 512 32
<tileset> D_Inside_House.png 512 512 32 <tileset> D_Inside_House.png 512 512 32
<cellmap> BLOCK 2
<cellmap> MOVETO 1
<cellmap> EVENT 3
<cellmap> TRIGGER 4
<cellmap> DOOR dark-door.png,32
<cellmap> CHEST 390
<soundmap> DOOR qubodup-DoorOpen01-changed.wav qubodup-DoorClose02-changed.wav doorLocked.wav
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
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 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

View File

@ -6,9 +6,9 @@ BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EM
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block BLOCK
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY moveto,1,2,openspace EMPTY EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY moveto,1,2,openspace EMPTY EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY moveto,1,2,openspace EMPTY EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY moveto,2,2,openspace EMPTY EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK
BLOCK CHEST,trashcan,true EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK BLOCK CHEST,trashcan,true EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block
BLOCK BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK BLOCK BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK,d BLOCK,d BLOCK,d EMPTY BLOCK,d BLOCK
BLOCK BLOCK DOOR,true,locked BLOCK BLOCK BLOCK BLOCK DOOR,true,locked BLOCK BLOCK BLOCK BLOCK DOOR,true,locked BLOCK BLOCK BLOCK BLOCK DOORTO,locked,true,white-key-card,2,1,treasure BLOCK BLOCK BLOCK BLOCK DOOR,true,locked BLOCK BLOCK BLOCK BLOCK DOOR,true,locked BLOCK BLOCK BLOCK BLOCK DOOR,true,locked BLOCK BLOCK BLOCK BLOCK DOORTO,locked,true,white-key-card,3,1,treasure BLOCK BLOCK

View File

@ -1,5 +0,0 @@
BLOCK 2
MOVETO 1
EVENT 0
TRIGGER 4
DOOR dark-door.png,32

View File

@ -3,6 +3,12 @@
<tileset> Openspace2.png 512 512 32 <tileset> Openspace2.png 512 512 32
<tileset> D_Inside_House.png 512 512 32 <tileset> D_Inside_House.png 512 512 32
<items> TransparentIcons.png 512 640 32 <items> TransparentIcons.png 512 640 32
<cellmap> BLOCK 2
<cellmap> MOVETO 1
<cellmap> EVENT 0
<cellmap> TRIGGER 4
<cellmap> DOOR dark-door.png,32
<soundmap> DOOR qubodup-DoorOpen01-changed.wav qubodup-DoorClose02-changed.wav doorLocked.wav
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 117 117 117 117 117 117 117 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 117 117 117 117 117 117 117 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6
6 117 117 117 117 117 117 117 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 117 117 117 117 117 117 117 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6

View File

@ -15,7 +15,7 @@ BLOCK EMPTY block block inter,minecraft block block EMPTY BLOCK,u EMPTY EMPTY EM
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY DOOR,false EMPTY EMPTY EMPTY EMPTY EMPTY block block EMPTY block block block BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY DOOR,false EMPTY EMPTY EMPTY EMPTY EMPTY block block EMPTY block block block
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY moveto,1,2,office EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY moveto,1,2,office EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY BLOCK
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY moveto,7,2,m1 EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY SPAWN block EMPTY block EMPTY BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY moveto,2,2,office EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY SPAWN block EMPTY block EMPTY BLOCK
BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY block block EMPTY block block block BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY block block EMPTY block block block
BLOCK block EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block BLOCK block EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block
BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY block

View File

@ -1,5 +0,0 @@
BLOCK 0
MOVETO 0
EVENT 0
TRIGGER 0
DOOR dark-door.png,32

View File

@ -1,4 +1,9 @@
<tileset> CertificateOfShame.png 650 500 50 <tileset> CertificateOfShame.png 650 500 50
<cellmap> BLOCK 0
<cellmap> MOVETO 0
<cellmap> EVENT 0
<cellmap> TRIGGER 0
<cellmap> DOOR dark-door.png,32
0 10 20 30 40 50 60 70 80 90 100 110 120 0 10 20 30 40 50 60 70 80 90 100 110 120
1 11 21 31 41 51 61 71 81 91 101 111 121 1 11 21 31 41 51 61 71 81 91 101 111 121
2 12 22 32 42 52 62 72 82 92 102 112 122 2 12 22 32 42 52 62 72 82 92 102 112 122

View File

@ -1,6 +1,6 @@
13 10 13 10
block block block block block block moveto,2,3,office block block block block block block block block block block block block moveto,3,3,office 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 TRIGGER,horn 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

View File

@ -1,4 +0,0 @@
BLOCK 120
MOVETO 277
EVENT 334
TRIGGER 147

View File

@ -1,6 +1,10 @@
<tileset> A2_Ground.png 512 384 32 192 <tileset> A2_Ground.png 512 384 32 192
<tileset> D_OutDoor.png 512 512 32 256 <tileset> D_OutDoor.png 512 512 32 256
<tileset> tutorialtiles.png 288 96 32 448 <tileset> tutorialtiles.png 288 96 32 448
<cellmap> BLOCK 120
<cellmap> MOVETO 277
<cellmap> EVENT 334
<cellmap> TRIGGER 147
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1

View File

@ -5,7 +5,7 @@ BLOCK EMPTY EMPTY EMPTY EMPTY SPAWN 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 EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY TRIGGER,error BLOCK BLOCK EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY EMPTY TRIGGER,cutscene-error 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

View File

@ -1,8 +1,3 @@
m1
m2
m3
m4
m6
tutorial tutorial
openspace openspace
office office

View File

@ -1,48 +1,3 @@
<map>
<mapName>m1</mapName>
<events>
</events>
</map>
<map>
<mapName>m2</mapName>
<events>
<trigger>
<x>7</x>
<y>2</y>
<active>true</active>
</trigger>
</events>
</map>
<map>
<mapName>m3</mapName>
<events>
<trigger>
<x>2</x>
<y>5</y>
<active>true</active>
</trigger>
</events>
</map>
<map>
<mapName>m4</mapName>
<events>
<trigger>
<x>3</x>
<y>3</y>
<active>true</active>
</trigger>
</events>
</map>
<map>
<mapName>m6</mapName>
<events>
<trigger>
<x>11</x>
<y>11</y>
<active>true</active>
</trigger>
</events>
</map>
<map> <map>
<mapName>tutorial</mapName> <mapName>tutorial</mapName>
<events> <events>
@ -59,12 +14,12 @@
<trigger> <trigger>
<x>7</x> <x>7</x>
<y>4</y> <y>4</y>
<active>false</active> <active>true</active>
</trigger> </trigger>
<chest> <chest>
<x>15</x> <x>15</x>
<y>7</y> <y>7</y>
<active>true</active> <active>false</active>
</chest> </chest>
</events> </events>
</map> </map>
@ -74,7 +29,7 @@
<chest> <chest>
<x>1</x> <x>1</x>
<y>9</y> <y>9</y>
<active>true</active> <active>false</active>
</chest> </chest>
</events> </events>
</map> </map>
@ -84,12 +39,17 @@
<trigger> <trigger>
<x>4</x> <x>4</x>
<y>18</y> <y>18</y>
<active>false</active> <active>true</active>
</trigger> </trigger>
</events> </events>
</map> </map>
<map> <map>
<mapName>treasure</mapName> <mapName>treasure</mapName>
<events> <events>
<trigger>
<x>6</x>
<y>1</y>
<active>false</active>
</trigger>
</events> </events>
</map> </map>

View File

@ -1,6 +1,6 @@
<location> <location>
<map>openspace</map> <map>office</map>
<x>8</x> <x>17</x>
<y>15</y> <y>11</y>
<direction>3</direction> <direction>2</direction>
</location> </location>

Binary file not shown.