Show boundingbox info/debug with 'o'
This commit is contained in:
parent
e643ec092d
commit
3a65c74546
|
@ -1,6 +1,7 @@
|
|||
package main;
|
||||
|
||||
import ea.Game;
|
||||
import ea.Taste;
|
||||
import main.HUD.HUD;
|
||||
import main.worlds.TestWorld;
|
||||
import main.worlds.World;
|
||||
|
@ -11,6 +12,7 @@ import main.worlds.World;
|
|||
public class Main extends Game {
|
||||
|
||||
public static Main instance;
|
||||
public static boolean SHOW_DEBUG = false;
|
||||
|
||||
private World world;
|
||||
private HUD hud;
|
||||
|
@ -33,6 +35,9 @@ public class Main extends Game {
|
|||
|
||||
@Override
|
||||
public void tasteReagieren(int code) {
|
||||
if (code == Taste.O) {
|
||||
SHOW_DEBUG = !SHOW_DEBUG;
|
||||
}
|
||||
}
|
||||
|
||||
public World getWorld() {
|
||||
|
|
|
@ -37,11 +37,14 @@ public abstract class AnimatedEntity extends Entity {
|
|||
|
||||
@Override
|
||||
public void zeichnen(Graphics2D g, BoundingRechteck r) {
|
||||
g.setColor(Color.GREEN);
|
||||
if (Main.SHOW_DEBUG) {
|
||||
g.setColor(Color.CYAN);
|
||||
g.drawRect((int) actionFigur.positionX(), (int) actionFigur.positionY(),
|
||||
(int) actionFigur.getBreite(), (int) actionFigur.getHoehe());
|
||||
g.setColor(Color.GREEN);
|
||||
g.drawRect((int) ((posX - width / 2) * World.SCALE), (int) ((posY - height / 2) * World.SCALE),
|
||||
(int) (width * World.SCALE), (int) (height * World.SCALE));
|
||||
}
|
||||
super.zeichnen(g, r);
|
||||
}
|
||||
};
|
||||
|
@ -62,7 +65,7 @@ public abstract class AnimatedEntity extends Entity {
|
|||
}
|
||||
|
||||
/**
|
||||
* Spiegelt die figur autmatisch, wenn n<EFBFBD>tig.
|
||||
* Spiegelt die figur autmatisch, wenn nötig.
|
||||
*/
|
||||
protected void zustandSetzen(String name) {
|
||||
actionFigur.spiegelXSetzen(side);
|
||||
|
|
Loading…
Reference in New Issue