diff --git a/SuperPangWorld/src/de/thdeg/greiner/superpangworld/game/managers/GamePlayManager.java b/SuperPangWorld/src/de/thdeg/greiner/superpangworld/game/managers/GamePlayManager.java index 521bded..f88adc5 100644 --- a/SuperPangWorld/src/de/thdeg/greiner/superpangworld/game/managers/GamePlayManager.java +++ b/SuperPangWorld/src/de/thdeg/greiner/superpangworld/game/managers/GamePlayManager.java @@ -101,6 +101,8 @@ public class GamePlayManager { player.lives--; gameObjectManager.getLivesLabel().setLifeCount(player.lives); gameObjectManager.getBubbles().clear(); + gameObjectManager.getHarpoons().forEach(h -> h.stopSound()); + gameObjectManager.getHarpoons().clear(); specialBubblePresent = false; spawnBubbles = true; gameObjectManager.getGameOverlay().flashScreen(Color.red, 100); @@ -238,7 +240,7 @@ public class GamePlayManager { collidableGameObjects.add(gameObjectManager.getPlayerObject()); collidableGameObjects.addAll(gameObjectManager.getHarpoons()); - if(randomNumber<60){ + if(randomNumber<10){ RoundBubble roundBubble = new RoundBubble(gameView, collidableGameObjects); roundBubble.setGamePlayManager(this); gameObjectManager.getBubbles().add(roundBubble); @@ -279,7 +281,7 @@ public class GamePlayManager { public boolean shootHarpoon(Position startPosition){ if(gameView.timerExpired("ShootHarpoon","GamePlayManager") && gameObjectManager.getHarpoons().size()<2){ Harpoon harpoon = new Harpoon(gameView,new ArrayList<>()); - harpoon.getPosition().setTo(startPosition.x+16, startPosition.y-15); + harpoon.getPosition().setTo(startPosition.x+6, startPosition.y-15); harpoon.setGamePlayManager(this); gameObjectManager.getHarpoons().add(harpoon); gameObjectManager.getBubbles().forEach(b -> b.addCollidableGameObject(Collections.singletonList(harpoon))); diff --git a/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/base/Bubble.java b/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/base/Bubble.java index 3a3ac98..9967455 100644 --- a/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/base/Bubble.java +++ b/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/base/Bubble.java @@ -37,6 +37,7 @@ public abstract class Bubble extends CollidingGameObject implements MovingGameOb */ public Bubble(GameView gameView, ArrayList objectsToCollideWith){ super(gameView,objectsToCollideWith); + random = new Random(); rotation = 90; size = 10; width = (int) (12 * size); @@ -44,8 +45,7 @@ public abstract class Bubble extends CollidingGameObject implements MovingGameOb speedInPixel = 1; spawnID = UUID.randomUUID().getLeastSignificantBits(); - random = new Random(); - position.setTo(random.nextInt(GameView.WIDTH-width),-width); + position.setTo(HelperValues.FRAME_BORDER_WIDTH + random.nextInt((int)(GameView.WIDTH-width - (2*HelperValues.FRAME_BORDER_WIDTH))), -width); spawning = true; spawnSpeed = 500; gameView.setTimer("spawn"+spawnID,"bubble"+spawnID,spawnSpeed); @@ -110,16 +110,16 @@ public abstract class Bubble extends CollidingGameObject implements MovingGameOb // Wall bounce if((newLocation.getX() >= GameView.WIDTH - width - HelperValues.FRAME_BORDER_WIDTH) || newLocation.getX() <= HelperValues.FRAME_BORDER_WIDTH){ velocity = new Point2D.Double(velocity.getX() * -1.0, velocity.getY()); - if(this instanceof SpecialBubble){ - switchSpecialBubbleState((SpecialBubble) this); - } + } // Floor bounce if(newLocation.getY() >= HelperValues.FRAME_WINDOW_HEIGHT + HelperValues.FRAME_BORDER_WIDTH - width){ velocity = new Point2D.Double(velocity.getX(), velocity.getY() * -0.95); newLocation = new Point2D.Double(newLocation.getX(), HelperValues.FRAME_WINDOW_HEIGHT + HelperValues.FRAME_BORDER_WIDTH - width); if(this instanceof SpecialBubble){ - switchSpecialBubbleState((SpecialBubble) this); + SpecialBubble specialBubble = (SpecialBubble) this; + specialBubble.freezeState = !specialBubble.freezeState; + gameView.playSound("specialBounce.wav",false); } } @@ -127,11 +127,6 @@ public abstract class Bubble extends CollidingGameObject implements MovingGameOb } } - private void switchSpecialBubbleState(SpecialBubble specialBubble){ - specialBubble.freezeState = !specialBubble.freezeState; - gameView.playSound("specialBounce.wav",false); - } - /** * Get the score to add when bursting the bubble. * diff --git a/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/Harpoon.java b/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/Harpoon.java index 840265c..133f22b 100644 --- a/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/Harpoon.java +++ b/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/Harpoon.java @@ -2,6 +2,7 @@ package de.thdeg.greiner.superpangworld.graphics.moveable; import de.thdeg.greiner.superpangworld.gameview.GameView; import de.thdeg.greiner.superpangworld.graphics.base.*; +import de.thdeg.greiner.superpangworld.graphics.helper.HelperValues; import java.awt.*; import java.util.ArrayList; @@ -51,7 +52,7 @@ public class Harpoon extends CollidingGameObject implements MovingGameObject { boolean right = true; String rope = ""; - for(int i=0;i<100;i++){ + for(int i = 0; i< HelperValues.FRAME_WINDOW_HEIGHT; i++){ rope += " ".repeat(pre) + "k" + " ".repeat(post)+"\n"; if(right){ pre++; diff --git a/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/HexagonalBubble.java b/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/HexagonalBubble.java index 5f37ad3..35093dd 100644 --- a/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/HexagonalBubble.java +++ b/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/HexagonalBubble.java @@ -29,8 +29,8 @@ public class HexagonalBubble extends Bubble { width = (int) (128 * size); height = (int) (128 * size); - this.hitBox.width = width; - this.hitBox.height = height; + this.hitBox.width = (int)(width - (width*0.1) ); + this.hitBox.height = (int)(width - (width*0.1) ); } public HexagonalBubble(GameView gameView, ArrayList objectsToCollideWith, double size, double speedInPixel, Position position, boolean spawning, Point2D velocity){ @@ -39,14 +39,14 @@ public class HexagonalBubble extends Bubble { width = (int) (128 * size); height = (int) (128 * size); - this.hitBox.width = width; - this.hitBox.height = height; + this.hitBox.width = (int)(width - (width*0.1) ); + this.hitBox.height = (int)(width - (width*0.1) ); } @Override protected void updateHitBoxPosition() { - hitBox.x = (int) position.x; - hitBox.y = (int) position.y; + hitBox.x = (int) (position.x + (width*0.05)); + hitBox.y = (int) (position.y + (width*0.05)); } @Override @@ -55,19 +55,16 @@ public class HexagonalBubble extends Bubble { } @Override - public void updateStatus() { - - } + public void updateStatus() {} @Override public void updatePosition() { super.updatePosition(); - rotation = (rotation + 1) % 360; + rotation = (rotation + 2) % 360; } @Override public int getBurstScore() { - // 1 0.5 0.25 0.125 switch((int)(size*1000)){ case 1000: return 200; diff --git a/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/PlayerObject.java b/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/PlayerObject.java index 9d5573a..ac9c90f 100644 --- a/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/PlayerObject.java +++ b/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/PlayerObject.java @@ -3,6 +3,7 @@ package de.thdeg.greiner.superpangworld.graphics.moveable; import de.thdeg.greiner.superpangworld.gameview.GameView; import de.thdeg.greiner.superpangworld.graphics.base.CollidableGameObject; +import java.awt.*; import java.util.Objects; /** @@ -33,8 +34,8 @@ public class PlayerObject extends CollidableGameObject implements Cloneable { height = (int) (41 * size); speedInPixel = 2; - this.hitBox.width = width; - this.hitBox.height = height; + this.hitBox.width = width - 20; + this.hitBox.height = height - 10; movingRight = false; movingLeft = false; @@ -44,8 +45,8 @@ public class PlayerObject extends CollidableGameObject implements Cloneable { @Override protected void updateHitBoxPosition() { - hitBox.x = (int) (position.x ); - hitBox.y = (int) (position.y); + hitBox.x = (int) (position.x + 10); + hitBox.y = (int) (position.y + 10); } @Override diff --git a/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/RoundBubble.java b/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/RoundBubble.java index 86f3fb9..c3006f4 100644 --- a/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/RoundBubble.java +++ b/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/RoundBubble.java @@ -5,6 +5,7 @@ import de.thdeg.greiner.superpangworld.graphics.base.Bubble; import de.thdeg.greiner.superpangworld.graphics.base.CollidableGameObject; import de.thdeg.greiner.superpangworld.graphics.base.Position; +import java.awt.*; import java.awt.geom.Point2D; import java.util.ArrayList; @@ -101,7 +102,6 @@ public class RoundBubble extends Bubble { gamePlayManager.addBubbles(bubbleLeft, bubbleRight); }else if(timeFreeze){ gamePlayManager.freezeMovement(1000); - System.out.println("FREEZING"); } } diff --git a/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/SpecialBubble.java b/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/SpecialBubble.java index 6d4fad7..2d44ba0 100644 --- a/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/SpecialBubble.java +++ b/SuperPangWorld/src/de/thdeg/greiner/superpangworld/graphics/moveable/SpecialBubble.java @@ -5,6 +5,7 @@ import de.thdeg.greiner.superpangworld.graphics.base.Bubble; import de.thdeg.greiner.superpangworld.graphics.base.CollidableGameObject; import de.thdeg.greiner.superpangworld.graphics.base.Position; +import java.awt.*; import java.util.ArrayList; /** diff --git a/SuperPangWorld/src/resources/behind.png b/SuperPangWorld/src/resources/behind.png index eb3c8f8..2820927 100644 Binary files a/SuperPangWorld/src/resources/behind.png and b/SuperPangWorld/src/resources/behind.png differ diff --git a/out/artifacts/Programmieren_2_jar/Programmieren 2.jar b/out/artifacts/Programmieren_2_jar/Programmieren 2.jar index 21c0f64..201f2ca 100644 Binary files a/out/artifacts/Programmieren_2_jar/Programmieren 2.jar and b/out/artifacts/Programmieren_2_jar/Programmieren 2.jar differ diff --git a/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/game/managers/GamePlayManager.class b/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/game/managers/GamePlayManager.class index 1df1054..7d4fc99 100644 Binary files a/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/game/managers/GamePlayManager.class and b/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/game/managers/GamePlayManager.class differ diff --git a/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/base/Bubble.class b/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/base/Bubble.class index 4c4d77b..72609ef 100644 Binary files a/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/base/Bubble.class and b/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/base/Bubble.class differ diff --git a/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/Harpoon.class b/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/Harpoon.class index 2d2066e..c63706b 100644 Binary files a/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/Harpoon.class and b/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/Harpoon.class differ diff --git a/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/HexagonalBubble.class b/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/HexagonalBubble.class index b4dd29f..b57432a 100644 Binary files a/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/HexagonalBubble.class and b/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/HexagonalBubble.class differ diff --git a/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/PlayerObject.class b/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/PlayerObject.class index bed9869..5f25fcf 100644 Binary files a/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/PlayerObject.class and b/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/PlayerObject.class differ diff --git a/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/RoundBubble.class b/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/RoundBubble.class index 73b09e7..fe6fe71 100644 Binary files a/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/RoundBubble.class and b/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/RoundBubble.class differ diff --git a/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/SpecialBubble.class b/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/SpecialBubble.class index 2025671..55aa1a1 100644 Binary files a/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/SpecialBubble.class and b/out/production/SuperPangWorld/de/thdeg/greiner/superpangworld/graphics/moveable/SpecialBubble.class differ diff --git a/out/production/SuperPangWorld/resources/behind.png b/out/production/SuperPangWorld/resources/behind.png index eb3c8f8..2820927 100644 Binary files a/out/production/SuperPangWorld/resources/behind.png and b/out/production/SuperPangWorld/resources/behind.png differ