diff --git a/GameProject.zip b/GameProject.zip deleted file mode 100644 index 7ea9faa..0000000 Binary files a/GameProject.zip and /dev/null differ diff --git a/GameProject/src/playground/BreakoutLevel2.java b/GameProject/src/playground/BreakoutLevel2.java index a312ebe..2812a0a 100644 --- a/GameProject/src/playground/BreakoutLevel2.java +++ b/GameProject/src/playground/BreakoutLevel2.java @@ -40,10 +40,40 @@ public class BreakoutLevel2 extends BreakoutLevelBaseAdvanced { @Override protected void actionIfBallHitsBrick(GameObject ball, GameObject brick) { + for(int i = 0; i < 20; i++) { - //Zufällige Farbe - gameobjects.FallingStar effect = new gameobjects.FallingStar("effect" + i, this, brick.getX(), brick.getY(), -240, 240, Color.RED, 3); - this.addObject(effect); + + //Zufällige Geschwindigkeiten + int effectVX = (int)(Math.random() * 480) - 240; + int effectVY = (int)(Math.random() * 480) - 240; + + //Fallingstarobject +// gameobjects.FallingStar effect = new gameobjects.FallingStar("effect" + i, this, brick.getX(), brick.getY(), effectVX, effectVY, Color.RED, 3); +// effect.addController(new controller.LimitedTimeController(getGameTime(), 2)); +// this.addObject(effect); + + double a = Math.random(); + if(a <= 0.25) { + gameobjects.FallingStar effect0 = new gameobjects.FallingStar("effect" + i, this, brick.getX(), brick.getY(), effectVX, effectVY, Color.GREEN, 3); + effect0.addController(new controller.LimitedTimeController(getGameTime(), 2)); + this.addObject(effect0); + } + if(a > 0.25 && a <= 0.5) { + gameobjects.FallingStar effect1 = new gameobjects.FallingStar("effect" + i, this, brick.getX(), brick.getY(), effectVX, effectVY, Color.BLUE, 3); + effect1.addController(new controller.LimitedTimeController(getGameTime(), 2)); + this.addObject(effect1); + } + if(a > 0.5 && a <= 0.75) { + gameobjects.FallingStar effect2 = new gameobjects.FallingStar("effect" + i, this, brick.getX(), brick.getY(), effectVX, effectVY, Color.PINK, 3); + effect2.addController(new controller.LimitedTimeController(getGameTime(), 2)); + this.addObject(effect2); + } + if(a > 0.75) { + gameobjects.FallingStar effect3 = new gameobjects.FallingStar("effect" + i, this, brick.getX(), brick.getY(), effectVX, effectVY, Color.YELLOW, 3); + effect3.addController(new controller.LimitedTimeController(getGameTime(), 2)); + this.addObject(effect3); + } + } this.ball.setVY(this.ball.getVY()*-1);