mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2024-11-25 04:39:43 +01:00
Compare commits
No commits in common. "748226f4edc3ea3eb186511a1f83328b0f6cd0fc" and "4a8304ee4f89b613308850a772669cdc8dac7847" have entirely different histories.
748226f4ed
...
4a8304ee4f
@ -5,13 +5,47 @@
|
|||||||
## (c) Mark Minas (mark.minas@unibw.de)
|
## (c) Mark Minas (mark.minas@unibw.de)
|
||||||
########################################
|
########################################
|
||||||
#
|
#
|
||||||
# Monopoly client configuration
|
# Battleship client configuration
|
||||||
|
#
|
||||||
|
# Specifies the map used by the opponent in single mode.
|
||||||
|
# Single mode is activated if this property is set.
|
||||||
|
#map.opponent=maps/map2.json
|
||||||
|
#
|
||||||
|
# Specifies the map used by the player in single mode.
|
||||||
|
# The player must define their own map if this property is not set.
|
||||||
|
map.own=maps/map1.json
|
||||||
|
#
|
||||||
|
# Coordinates of the shots fired by the RobotClient in the order listed.
|
||||||
|
# Example:
|
||||||
|
# 2, 0,\
|
||||||
|
# 2, 1,\
|
||||||
|
# 2, 2,\
|
||||||
|
# 2, 3
|
||||||
|
# defines four shots, namely at the coordinates
|
||||||
|
# (x=2, y=0), (x=2, y=1), (x=2, y=2), and (x=2, y=3)
|
||||||
|
robot.targets=2, 0,\
|
||||||
|
2, 1,\
|
||||||
|
2, 2,\
|
||||||
|
2, 3
|
||||||
|
#
|
||||||
|
# Delay in milliseconds between each shot fired by the RobotClient.
|
||||||
|
robot.delay=500
|
||||||
#
|
#
|
||||||
# The dimensions of the game map used in single mode.
|
# The dimensions of the game map used in single mode.
|
||||||
# 'map.width' defines the number of columns, and 'map.height' defines the number of rows.
|
# 'map.width' defines the number of columns, and 'map.height' defines the number of rows.
|
||||||
map.width=10
|
map.width=10
|
||||||
map.height=10
|
map.height=10
|
||||||
#
|
#
|
||||||
|
# The number of ships of each length available in single mode.
|
||||||
|
# The value is a comma-separated list where each element corresponds to the number of ships
|
||||||
|
# with a specific length. For example:
|
||||||
|
# ship.nums=4, 3, 2, 1
|
||||||
|
# This configuration means:
|
||||||
|
# - 4 ships of length 1
|
||||||
|
# - 3 ships of length 2
|
||||||
|
# - 2 ships of length 3
|
||||||
|
# - 1 ship of length 4
|
||||||
|
ship.nums=4, 3, 2, 1
|
||||||
#
|
#
|
||||||
# Screen settings
|
# Screen settings
|
||||||
#
|
#
|
||||||
|
@ -39,22 +39,21 @@ public class CameraController {
|
|||||||
* @param tpf Zeit pro Frame
|
* @param tpf Zeit pro Frame
|
||||||
*/
|
*/
|
||||||
public void update(float tpf) {
|
public void update(float tpf) {
|
||||||
|
// Aktualisiere den Winkel basierend auf der Geschwindigkeit
|
||||||
|
angle += speed * tpf;
|
||||||
|
if (angle >= FastMath.TWO_PI) {
|
||||||
|
angle -= FastMath.TWO_PI; // Winkel zurücksetzen, um Überläufe zu vermeiden
|
||||||
|
}
|
||||||
|
|
||||||
|
// Berechne die neue Position der Kamera
|
||||||
|
float x = center.x + radius * FastMath.cos(angle);
|
||||||
|
float z = center.z + radius * FastMath.sin(angle);
|
||||||
|
float y = center.y + height;
|
||||||
|
|
||||||
|
// Setze die Kameraposition
|
||||||
|
camera.setLocation(new Vector3f(x, y, z));
|
||||||
|
|
||||||
|
// Lasse die Kamera auf den Fokuspunkt blicken
|
||||||
camera.lookAt(center, Vector3f.UNIT_Y);
|
camera.lookAt(center, Vector3f.UNIT_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPosition(int fieldID) {
|
|
||||||
camera.setLocation(fieldIdToVector(fieldID));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPosition(float x, float y) {
|
|
||||||
camera.setLocation(new Vector3f(x,height,y));
|
|
||||||
}
|
|
||||||
|
|
||||||
private Vector3f fieldIdToVector(int fieldID) {
|
|
||||||
if (fieldID <= 10) return new Vector3f(4,height,0);
|
|
||||||
if (fieldID <= 20) return new Vector3f(0, height, 4);
|
|
||||||
if (fieldID <= 30) return new Vector3f(-4, height, 0);
|
|
||||||
if (fieldID <= 40) return new Vector3f(0, height, -4);
|
|
||||||
else throw new IllegalArgumentException();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,5 @@
|
|||||||
package pp.monopoly.client.gui;
|
package pp.monopoly.client.gui;
|
||||||
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.ScheduledExecutorService;
|
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import com.jme3.material.Material;
|
import com.jme3.material.Material;
|
||||||
import com.jme3.math.ColorRGBA;
|
import com.jme3.math.ColorRGBA;
|
||||||
import com.jme3.math.Vector3f;
|
import com.jme3.math.Vector3f;
|
||||||
@ -47,18 +43,15 @@ public class TestWorld {
|
|||||||
cameraController = new CameraController(
|
cameraController = new CameraController(
|
||||||
app.getCamera(), // Die Kamera der App
|
app.getCamera(), // Die Kamera der App
|
||||||
Vector3f.ZERO, // Fokus auf die Mitte des Spielfelds
|
Vector3f.ZERO, // Fokus auf die Mitte des Spielfelds
|
||||||
4, // Radius des Kreises
|
5, // Radius des Kreises
|
||||||
2, // Höhe der Kamera
|
3, // Höhe der Kamera
|
||||||
0 // Geschwindigkeit der Bewegung
|
0.5f // Geschwindigkeit der Bewegung
|
||||||
);
|
);
|
||||||
|
|
||||||
// Füge die Toolbar hinzu
|
// Füge die Toolbar hinzu
|
||||||
new Toolbar(app, cube);
|
new Toolbar(app, cube);
|
||||||
|
|
||||||
cameraController.setPosition(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Aktualisiert die Kameraposition.
|
* Aktualisiert die Kameraposition.
|
||||||
*
|
*
|
||||||
|
Loading…
Reference in New Issue
Block a user