mirror of
https://github.com/jokerx3/HeatUp
synced 2026-07-27 08:49:44 +02:00
Logging erweiterungen
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package de.heatup.mapengine;
|
||||
|
||||
import de.heatup.logging.Logger;
|
||||
import de.heatup.testing.Player;
|
||||
|
||||
public class CollisionHandler {
|
||||
@@ -13,22 +14,22 @@ public class CollisionHandler {
|
||||
switch (d) {
|
||||
case 'l':
|
||||
if (MapGrid.getGridCell(movingObject.getGridLocation().x-1, movingObject.getGridLocation().y).isPath() && MapGrid.getGridCell(movingObject.getGridLocation().x-1, movingObject.getGridLocation().y).isTrigger()) {
|
||||
System.out.println("Collision with trigger of hardware ID: " + MapGrid.getGridCell(movingObject.getGridLocation().x-1, movingObject.getGridLocation().y).getCorrespondingHardwareToTrigger());
|
||||
Logger.write("Collision with trigger of hardware ID: " + MapGrid.getGridCell(movingObject.getGridLocation().x-1, movingObject.getGridLocation().y).getCorrespondingHardwareToTrigger());
|
||||
}
|
||||
return MapGrid.getGridCell(movingObject.getGridLocation().x-1, movingObject.getGridLocation().y).isPath();
|
||||
case 'r':
|
||||
if (MapGrid.getGridCell(movingObject.getGridLocation().x+1, movingObject.getGridLocation().y).isPath() && MapGrid.getGridCell(movingObject.getGridLocation().x+1, movingObject.getGridLocation().y).isTrigger()) {
|
||||
System.out.println("Collision with trigger of hardware ID: " + MapGrid.getGridCell(movingObject.getGridLocation().x+1, movingObject.getGridLocation().y).getCorrespondingHardwareToTrigger());
|
||||
Logger.write("Collision with trigger of hardware ID: " + MapGrid.getGridCell(movingObject.getGridLocation().x+1, movingObject.getGridLocation().y).getCorrespondingHardwareToTrigger());
|
||||
}
|
||||
return MapGrid.getGridCell(movingObject.getGridLocation().x+1, movingObject.getGridLocation().y).isPath();
|
||||
case 'd':
|
||||
if (MapGrid.getGridCell(movingObject.getGridLocation().x, movingObject.getGridLocation().y+1).isPath() && MapGrid.getGridCell(movingObject.getGridLocation().x, movingObject.getGridLocation().y+1).isTrigger()) {
|
||||
System.out.println("Collision with trigger of hardware ID: " + MapGrid.getGridCell(movingObject.getGridLocation().x, movingObject.getGridLocation().y+1).getCorrespondingHardwareToTrigger());
|
||||
Logger.write("Collision with trigger of hardware ID: " + MapGrid.getGridCell(movingObject.getGridLocation().x, movingObject.getGridLocation().y+1).getCorrespondingHardwareToTrigger());
|
||||
}
|
||||
return MapGrid.getGridCell(movingObject.getGridLocation().x, movingObject.getGridLocation().y+1).isPath();
|
||||
case 'u':
|
||||
if (MapGrid.getGridCell(movingObject.getGridLocation().x, movingObject.getGridLocation().y-1).isPath() && MapGrid.getGridCell(movingObject.getGridLocation().x, movingObject.getGridLocation().y-1).isTrigger()) {
|
||||
System.out.println("Collision with trigger of hardware ID: " + MapGrid.getGridCell(movingObject.getGridLocation().x, movingObject.getGridLocation().y-1).getCorrespondingHardwareToTrigger());
|
||||
Logger.write("Collision with trigger of hardware ID: " + MapGrid.getGridCell(movingObject.getGridLocation().x, movingObject.getGridLocation().y-1).getCorrespondingHardwareToTrigger());
|
||||
}
|
||||
return MapGrid.getGridCell(movingObject.getGridLocation().x, movingObject.getGridLocation().y-1).isPath();
|
||||
default:
|
||||
|
||||
@@ -4,9 +4,11 @@ import java.awt.BorderLayout;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Point;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
import de.heatup.logging.Logger;
|
||||
import de.heatup.mapengine.MapEngine;
|
||||
import de.heatup.mapengine.SpawnAssistant;
|
||||
import de.heatup.objects.StaticObject;
|
||||
@@ -37,6 +39,9 @@ public class GameLoopD extends JFrame implements Runnable {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
// Logging ausgabe auf Console aktivieren bzw. deaktivieren.
|
||||
Logger.enableLogging();
|
||||
|
||||
/*
|
||||
* hier drin bauen wir unser ui zusammen.
|
||||
*/
|
||||
@@ -188,7 +193,7 @@ public class GameLoopD extends JFrame implements Runnable {
|
||||
|
||||
if (System.currentTimeMillis() - timer > 1000) {
|
||||
timer += 1000;
|
||||
System.out.println(updates +" Ticks, fps " + frames);
|
||||
Logger.write(updates +" Ticks, fps " + frames);
|
||||
updates = 0;
|
||||
frames = 0;
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ import java.util.Random;
|
||||
import javax.imageio.ImageIO;
|
||||
|
||||
import de.heatup.cfg.Config;
|
||||
import de.heatup.logging.Logger;
|
||||
import de.heatup.mapengine.MapGrid;
|
||||
|
||||
public class Opponent extends Player {
|
||||
@@ -61,7 +62,7 @@ public class Opponent extends Player {
|
||||
|
||||
// Blockade auflösen, gehe doch in die Richtung aus man gekommen ist
|
||||
if ( this.blocked ) {
|
||||
System.out.println("Warning: Block detected!");
|
||||
Logger.write("Warning: Block detected!");
|
||||
this.i *= -1;
|
||||
this.blocked = false;
|
||||
this.blockedCounter = 0;
|
||||
|
||||
@@ -13,6 +13,7 @@ import javax.imageio.ImageIO;
|
||||
import javax.swing.JComponent;
|
||||
|
||||
import de.heatup.cfg.Config;
|
||||
import de.heatup.logging.Logger;
|
||||
|
||||
public class Player extends JComponent {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -116,7 +117,7 @@ public class Player extends JComponent {
|
||||
if (stepCounter <= 0) {
|
||||
stepCounter = 25;
|
||||
//debug
|
||||
System.out.println("on grid - x: "+getGridLocation().x + " y: "+getGridLocation().y);
|
||||
Logger.write("on grid - x: "+getGridLocation().x + " y: "+getGridLocation().y);
|
||||
}
|
||||
}
|
||||
startMove = false;
|
||||
|
||||
Reference in New Issue
Block a user