diff --git a/examples/zm_hehomon/Display.java b/examples/zm_hehomon/Display.java index 5acdd63..f52851e 100644 --- a/examples/zm_hehomon/Display.java +++ b/examples/zm_hehomon/Display.java @@ -19,6 +19,7 @@ public class Display extends ShapeGroup { text.setFontColor(255); text.setFontsize(20); text.setAnchor(NORTHWEST); + text.setFont("fonts/FredokaOne-Regular.ttf"); add(background, text); } diff --git a/examples/zm_hehomon/HehomonGame.java b/examples/zm_hehomon/HehomonGame.java index 98af406..89f89e4 100644 --- a/examples/zm_hehomon/HehomonGame.java +++ b/examples/zm_hehomon/HehomonGame.java @@ -1,10 +1,9 @@ -import schule.ngb.zm.Constants; import schule.ngb.zm.ImageLayer; import schule.ngb.zm.Spielemaschine; -import schule.ngb.zm.shapes.Picture; +import schule.ngb.zm.util.FontLoader; -import java.awt.Image; -import java.awt.event.KeyEvent; +import java.awt.Font; +import java.lang.reflect.InvocationTargetException; public class HehomonGame extends Spielemaschine { @@ -23,20 +22,39 @@ public class HehomonGame extends Spielemaschine { private boolean idle = true; + private static final Class[] HEHOMONS = new Class[]{ + Alligung.class, Salamanyte.class, Gardon.class, Mantairy.class, Shigong.class, Toxo.class, Wokachu.class + }; + public HehomonGame() { super(960, 642, "ZM: Hehomon"); - setFullscreen(true); + //setFullscreen(true); + } + + private Hehomon newHehomon() { + try { + Class clazz = (Class) choice(HEHOMONS); + return clazz.getConstructor().newInstance(); + } catch( NoSuchMethodException | InstantiationException | + IllegalAccessException | InvocationTargetException ex ) { + exit(); + return null; + } } @Override public void setup() { + Font font = FontLoader.loadFont("fonts/FredokaOne-Regular.ttf" ); + ImageLayer bg = new ImageLayer("images/hintergrund.jpg"); canvas.addLayer(1, bg); - attacker = new Alligung(); + + + attacker = newHehomon(); attacker.moveTo(width * .25, 250); attacker.flip(LEFT); - defender = new Salamanyte(); + defender = newHehomon(); defender.moveTo(width * .75, 250); hpAttacker = new Hitpoints(attacker); diff --git a/examples/zm_hehomon/Menu.java b/examples/zm_hehomon/Menu.java index 5378527..1d26c0c 100755 --- a/examples/zm_hehomon/Menu.java +++ b/examples/zm_hehomon/Menu.java @@ -17,7 +17,7 @@ public class Menu extends ShapeGroup { lines = new Text[4]; for( int i = 0; i < lines.length; i++ ) { - lines[i] = new Text(5, 5+i*25, ""); + lines[i] = new Text(5, 5+i*25, "", "Arial-BOLD-20"); lines[i].setFontColor(WHITE); lines[i].setFontsize(20); lines[i].setAnchor(NORTHWEST); diff --git a/examples/zm_hehomon/fonts/FredokaOne-Regular.ttf b/examples/zm_hehomon/fonts/FredokaOne-Regular.ttf new file mode 100755 index 0000000..9b384aa Binary files /dev/null and b/examples/zm_hehomon/fonts/FredokaOne-Regular.ttf differ diff --git a/examples/zm_hehomon/music/Water-Balloon-Maniacs.mp3 b/examples/zm_hehomon/music/Water-Balloon-Maniacs.mp3 new file mode 100755 index 0000000..3bcfe9e Binary files /dev/null and b/examples/zm_hehomon/music/Water-Balloon-Maniacs.mp3 differ