Returns an array containing the constants of this enum type, in
+the order they are declared. This method may be used to iterate
+over the constants as follows:
+
+for (Sound c : Sound.values())
+ System.out.println(c);
+
+
Returns:
an array containing the constants of this enum type, in the order they are declared
public static Sound valueOf(java.lang.String name)
+
Returns the enum constant of this type with the specified name.
+The string must match exactly an identifier used to declare an
+enum constant in this type. (Extraneous whitespace characters are
+not permitted.)
+
Parameters:
name - the name of the enum constant to be returned.
+
Returns:
the enum constant with the specified name
+
Throws:
+
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
+
java.lang.NullPointerException - if the argument is null
Diese Klasse soll als primäre Schnittstelle dieses Packages zu anderen Spielmodulen dienen.
+ Sie generiert die Map als StaticObjects um diese dann auf ein Spielfeld zu malen.
+ Außerdem erstellt sie eine MapGrid, welches zur Kollisionserkennung und Positionierung
+ von Entitäten dient.
Gibt alle HardwareTriggerObjekte auf einer Map als ArrayList zurück.
-
+
printMapGridWithTriggers
public void printMapGridWithTriggers()
+
Deprecated.Schreibt eine mit Trigger konvertierte Map-Datei in die Konsole.
+ Diese Methode existiert nur zu Testzwecken und ist daher deprecated markiert.
The Overview page is the front page of this API document and provides a list of all packages with a summary for each. This page can also contain an overall description of the set of packages.
+
+
Package
Each package has a page that contains a list of its classes and interfaces, with a summary for each. This page can contain six categories:
diff --git a/HeatUp/src/de/heatup/cfg/Config.java b/HeatUp/src/de/heatup/cfg/Config.java
index 7f888c8..6617ef5 100644
--- a/HeatUp/src/de/heatup/cfg/Config.java
+++ b/HeatUp/src/de/heatup/cfg/Config.java
@@ -25,6 +25,8 @@ public class Config {
public static final char firstHardwareChar = '0';
public static final char lastHardwareChar = '9';
+ public static final int spawnDistance = 30;
+
/*
* Attribute
* de.heatup.ein.anderes.package.*
@@ -33,6 +35,11 @@ public class Config {
* Methoden
* de.heatup.mapengine.*
*/
+ /**
+ * Setzt die Spielfeldbreite und updated die Einzelteilbreite
+ * @deprecated
+ * @param width
+ */
public static void setGamePanelWidth(int width) {
// Wir wollen hier keine Reste!
while (width % mapMaxTilesWidth != 0) {
@@ -41,6 +48,10 @@ public class Config {
gamePanelWidth = width;
updateSingleTilePixels();
}
+ /**
+ * @deprecated
+ * Updated die Einzelteilbreite
+ */
private static void updateSingleTilePixels() {
singleTilePixels = gamePanelWidth/mapMaxTilesWidth;
}
diff --git a/HeatUp/src/de/heatup/mapengine/MapEngine.java b/HeatUp/src/de/heatup/mapengine/MapEngine.java
index 2b38e62..e174586 100644
--- a/HeatUp/src/de/heatup/mapengine/MapEngine.java
+++ b/HeatUp/src/de/heatup/mapengine/MapEngine.java
@@ -18,7 +18,7 @@ import de.heatup.objects.*;
* Sie generiert die Map als StaticObjects um diese dann auf ein Spielfeld zu malen.
* Außerdem erstellt sie eine MapGrid, welches zur Kollisionserkennung und Positionierung
* von Entitäten dient.
- * @author daniel
+ * @author Daniel
*
*/
public class MapEngine {
@@ -33,7 +33,10 @@ public class MapEngine {
HashMap> allMapTiles = new HashMap>();
ArrayList availableHardwareTileTypes = new ArrayList();
-
+ /**
+ * Lädt die Map mit angegebener mapNumber.
+ * @param mapNumber Die Nummer der zu ladenen Map
+ */
public MapEngine(int mapNumber) {
Scanner input = null;
try {
@@ -46,7 +49,9 @@ public class MapEngine {
this.createTiles(input);
}
-
+ /**
+ * Öffnet einen File Chooser um eine Custom Map auszuwählen, welche anschließend geladen wird.
+ */
public MapEngine() {
Scanner input = null;
try {
@@ -155,14 +160,18 @@ public class MapEngine {
protected ArrayList getAllCoordinatesOfTileType(char c) {
return getAllMapTiles().get(c);
}
- /*
- * obsolet bisher.
+ /**
+ * @deprecated
+ * @param c
+ * @return
*/
protected Point getFirstTilesCoordinatesOfTileType(char c) {
return getAllMapTiles().get(c).get(0);
}
- /*
- * obsolet bisher.
+ /**
+ * @deprecated
+ * @param c
+ * @return
*/
protected Point getLastTilesCoordinatesOfTileType(char c) {
return getAllMapTiles().get(c).get(getAllMapTiles().get(c).size()-1);
@@ -216,7 +225,9 @@ public class MapEngine {
return false;
}
/**
- * Schreibt eine mit Trigger konvertierte Map-Datei in die Konsole
+ * @deprecated
+ * Schreibt eine mit Trigger konvertierte Map-Datei in die Konsole.
+ * Diese Methode existiert nur zu Testzwecken und ist daher deprecated markiert.
*/
public void printMapGridWithTriggers() {
for (int i = 0; i < Config.mapMaxTilesHeight; i++) {
@@ -237,8 +248,8 @@ public class MapEngine {
}
}
/**
- * test
- *
+ * Zeichnet die Map auf angegebenen Panel.
+ * @param gamePanel das JPanel auf das gezeichnet werden soll.
*/
public void addAllToPanel(JPanel gamePanel) {
for (StaticObject currentStaticObject : this.getAllMapObjects()) {
diff --git a/HeatUp/src/de/heatup/mapengine/MapGrid.java b/HeatUp/src/de/heatup/mapengine/MapGrid.java
index 05b67b5..3682dd0 100644
--- a/HeatUp/src/de/heatup/mapengine/MapGrid.java
+++ b/HeatUp/src/de/heatup/mapengine/MapGrid.java
@@ -6,8 +6,13 @@ public class MapGrid {
private static MapGridCell[][] allGridCells = new MapGridCell[Config.mapMaxTilesWidth][Config.mapMaxTilesHeight];
- private static MapGridCell dummyCell = new MapGridCell(); // wird zurückgegeben, falls der MapGrid index ausserhalb unserer allGridCells dimension zeigt.
-
+ private static MapGridCell dummyCell = new MapGridCell(); /* wird zurückgegeben, falls der MapGrid index ausserhalb unserer allGridCells dimension zeigt. */
+ /**
+ * Neue Grid Zelle an x und y hinzufügen und festlegen, ob die Zelle begehbar ist.
+ * @param x X-Koordinate
+ * @param y Y-Koordinate
+ * @param isPath legt fest, ob es sich hier um eine begehbare Zelle handelt.
+ */
protected static void addGrid(int x, int y, boolean isPath) {
if (!(x < 0 || x > Config.mapMaxTilesWidth || y < 0 || y > Config.mapMaxTilesHeight)) {
MapGridCell newCell = new MapGridCell();
@@ -15,7 +20,14 @@ public class MapGrid {
allGridCells[x][y] = newCell;
}
}
-
+ /**
+ * Neue Grid Zelle an x und y hinzufügen und festlegen, ob diese Zelle begehbar ist und ob es sich um einen Trigger handelt.
+ * @param x X-Koordinate
+ * @param y Y-Koordinate
+ * @param isPath legt fest, ob es sich hier um eine begehbare Zelle handelt.
+ * @param isTrigger legt fest, ob es sich hier um eine Trigger Zelle handelt.
+ * @param correspondingHardwareToTrigger legt fest, welche Hardware zu triggern ist.
+ */
protected static void addGrid(int x, int y, boolean isPath, boolean isTrigger, char correspondingHardwareToTrigger) {
if (!(x < 0 || x > Config.mapMaxTilesWidth || y < 0 || y > Config.mapMaxTilesHeight)) {
MapGridCell newCell = new MapGridCell();
@@ -25,7 +37,13 @@ public class MapGrid {
allGridCells[x][y] = newCell;
}
}
-
+ /**
+ * Neue Grid Zelle an x und y hinzufügen und festlegen, ob es sich um einen Trigger handelt.
+ * @param x X-Koordinate
+ * @param y Y-Koordinate
+ * @param isTrigger legt fest, ob es sich hier um eine Trigger Zelle handelt.
+ * @param correspondingHardwareToTrigger legt fest, welche Hardware zu triggern ist.
+ */
protected static void addGrid(int x, int y, boolean isTrigger, char correspondingHardwareToTrigger) {
if (!(x < 0 || x > Config.mapMaxTilesWidth || y < 0 || y > Config.mapMaxTilesHeight)) {
MapGridCell newCell = new MapGridCell();
@@ -34,7 +52,12 @@ public class MapGrid {
allGridCells[x][y] = newCell;
}
}
-
+ /**
+ * Liefert die GridCell von angegebener Position zurück.
+ * @param x X-Koordinate
+ * @param y Y-Koordinate
+ * @return liefert eine GridCell mit allen Eigenschaften zurück.
+ */
public static MapGridCell getGridCell(int x, int y) {
if (!(x < 0 || x > Config.mapMaxTilesWidth-1 || y < 0 || y > Config.mapMaxTilesHeight-1)) {
return allGridCells[x][y];
diff --git a/HeatUp/src/de/heatup/mapengine/SpawnAssistant.java b/HeatUp/src/de/heatup/mapengine/SpawnAssistant.java
index 8927d88..0368b9b 100644
--- a/HeatUp/src/de/heatup/mapengine/SpawnAssistant.java
+++ b/HeatUp/src/de/heatup/mapengine/SpawnAssistant.java
@@ -1,23 +1,47 @@
package de.heatup.mapengine;
import java.awt.Point;
+import java.util.ArrayList;
import java.util.Random;
import de.heatup.cfg.Config;
public class SpawnAssistant {
+ public static ArrayList spawnPoints = new ArrayList();
+ /**
+ * Sucht einen Spawnpunkt mit höchstmöglichem Abstand zu anderen Spawnpoints
+ * @return Returns a Spawnpoint
+ */
public static Point getPathLocationOnGrid() {
Point spawnPoint = null;
Random rand = new Random();
+ int distance = Config.spawnDistance;
+ int errorTolerance = 100;
+ int tryCount = 0;
boolean foundLocation = false;
while (!foundLocation) {
+ tryCount++;
+ if (tryCount==errorTolerance) {
+ tryCount = 0;
+ distance--;
+ }
int x = rand.nextInt(Config.mapMaxTilesWidth);
int y = rand.nextInt(Config.mapMaxTilesHeight);
if (MapGrid.getGridCell(x, y).isPath()) {
- spawnPoint = new Point(x,y);
- foundLocation = true;
+ boolean distanceOk = true;
+ if (spawnPoints.isEmpty()) distanceOk = true;
+ for (Point point : spawnPoints) {
+ if (Math.abs(x-point.x) HardwareResetTickstamps = new HashMap();
+ /**
+ * Zählt ticks und resettet somit Spielzeit orientiert die Hardware-Objekte.
+ */
public static void tick() {
tickCount++;
if (tickCount>=tickRoundMax) {
@@ -26,6 +29,10 @@ public class HardwareResetTimers {
}
}
}
+ /**
+ * Setzt das gegebene Hardware-Objekt auf "manipuliert" und merkt sich den aktuellen Tick + Resetzeit = Tick an dem resettet werden muss.
+ * @param c Hardware-Objekt, welches als manipuliert gelten soll.
+ */
public static void setManipulated(char c) {
int resetTimestamp = tickCount+nrOfTicksUntilReset;
if (resetTimestamp > tickRoundMax) {
diff --git a/HeatUp/src/de/heatup/ui/StatusPanelAdder.java b/HeatUp/src/de/heatup/ui/StatusPanelAdder.java
index ad9d624..54df9ec 100644
--- a/HeatUp/src/de/heatup/ui/StatusPanelAdder.java
+++ b/HeatUp/src/de/heatup/ui/StatusPanelAdder.java
@@ -17,8 +17,11 @@ public class StatusPanelAdder{
private Score score;
private Timer timer;
private static JPanel panel;
+ private static JLabel labelTemp= new JLabel("temperature");
+ private static JProgressBar tempBar;
private static int hgap=30;
private static int vgap=9;
+ private static boolean updown = true;
public int getTemp(){
return temp.getTemp();
@@ -35,13 +38,29 @@ public class StatusPanelAdder{
panel=newPanel;
}
+ public static void tick() {
+ int mod;
+ if (tempBar.getValue()==90) {
+ updown = false;
+ }
+ if (tempBar.getValue()==30) {
+ updown = true;
+ }
+ if (updown) {
+ mod = 1;
+ } else {
+ mod = -1;
+ }
+ tempBar.setValue((tempBar.getValue()+mod));
+
+
+ }
+
public static void createPanel(){
-
- JLabel labelTemp= new JLabel("temperature");
labelTemp.setFont(new Font("emulogic", Font.CENTER_BASELINE, 16));
labelTemp.setForeground(Color.YELLOW);
- JProgressBar tempBar= new JProgressBar(30,90);
+ tempBar= new JProgressBar(30,90);
tempBar.setValue(45);
JPanel tempPanel=new JPanel();