Aufgaben 6
This commit is contained in:
		
							parent
							
								
									973a4e9710
								
							
						
					
					
						commit
						dc1f89a176
					
				
							
								
								
									
										2
									
								
								.idea/artifacts/Programmieren_2_jar.xml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2
									
								
								.idea/artifacts/Programmieren_2_jar.xml
									
									
									
										generated
									
									
									
								
							| @ -1,5 +1,5 @@ | ||||
| <component name="ArtifactManager"> | ||||
|   <artifact type="jar" name="Programmieren 2:jar"> | ||||
|   <artifact type="jar" build-on-make="true" name="Programmieren 2:jar"> | ||||
|     <output-path>$PROJECT_DIR$/out/artifacts/Programmieren_2_jar</output-path> | ||||
|     <root id="archive" name="Programmieren 2.jar"> | ||||
|       <element id="module-output" name="Programmieren 2" /> | ||||
|  | ||||
| @ -1,10 +1,13 @@ | ||||
| package de.thdeg.greiner.superpangworld.game.managers; | ||||
| 
 | ||||
| import de.thdeg.greiner.superpangworld.gameview.GameView; | ||||
| import de.thdeg.greiner.superpangworld.graphics.base.Bubble; | ||||
| import de.thdeg.greiner.superpangworld.graphics.base.GameObject; | ||||
| import de.thdeg.greiner.superpangworld.graphics.immovable.*; | ||||
| import de.thdeg.greiner.superpangworld.graphics.moveable.*; | ||||
| 
 | ||||
| import java.awt.*; | ||||
| import java.util.LinkedList; | ||||
| 
 | ||||
| /** | ||||
|  * The manager handling the display and passive movement of the game objects. | ||||
| @ -15,10 +18,8 @@ class GameObjectManager { | ||||
|     private GameView gameView; | ||||
| 
 | ||||
|     /** The game objects */ | ||||
|     private RoundBubble roundBubble; | ||||
|     private HexagonalBubble hexBubble; | ||||
|     private SpecialBubble specialBubble; | ||||
|     private Harpoon harpoon; | ||||
|     private LinkedList<Bubble> bubbles; | ||||
|     private LinkedList<Harpoon> harpoons; | ||||
|     private LevelProgressBar levelProgressBar; | ||||
|     private LevelLabel levelLabel; | ||||
|     private ScoreLabel scoreLabel; | ||||
| @ -26,20 +27,25 @@ class GameObjectManager { | ||||
|     private Background background; | ||||
|     private Player player; | ||||
| 
 | ||||
|     private LinkedList<GameObject> gameObjects; | ||||
| 
 | ||||
|     /** | ||||
|      * Create a manager handling the display and passive movement of the game objects. | ||||
|      * @param gameView the GameView | ||||
|      */ | ||||
|     public GameObjectManager(GameView gameView){ | ||||
|         this.gameView = gameView; | ||||
| 
 | ||||
|         gameView.setColorForBlockImage('k', Color.LIGHT_GRAY); | ||||
| 
 | ||||
|         this.roundBubble = new RoundBubble(gameView); | ||||
|         this.hexBubble = new HexagonalBubble(gameView); | ||||
|         this.specialBubble = new SpecialBubble(gameView); | ||||
|         bubbles = new LinkedList<>(); | ||||
|         harpoons = new LinkedList<>(); | ||||
|         gameObjects = new LinkedList<>(); | ||||
| 
 | ||||
|         this.harpoon = new Harpoon(gameView); | ||||
|         bubbles.add(new RoundBubble(gameView)); | ||||
|         bubbles.add(new HexagonalBubble(gameView)); | ||||
|         bubbles.add(new SpecialBubble(gameView)); | ||||
| 
 | ||||
|         harpoons.add(new Harpoon(gameView)); | ||||
| 
 | ||||
|         this.levelProgressBar = new LevelProgressBar(gameView); | ||||
|         this.levelLabel = new LevelLabel(gameView); | ||||
| @ -57,22 +63,21 @@ class GameObjectManager { | ||||
|      * Add the objects to the canvas and handle update their positions. | ||||
|      */ | ||||
|     public void updateGameObjects(){ | ||||
|         background.addToCanvas(); | ||||
|         roundBubble.updatePosition(); | ||||
|         roundBubble.addToCanvas(); | ||||
|         hexBubble.updatePosition(); | ||||
|         hexBubble.addToCanvas(); | ||||
|         specialBubble.updatePosition(); | ||||
|         specialBubble.addToCanvas(); | ||||
|         harpoon.updatePosition(); | ||||
|         harpoon.addToCanvas(); | ||||
|         gameObjects.clear(); | ||||
|         gameObjects.add(background); | ||||
|         gameObjects.addAll(bubbles); | ||||
|         gameObjects.addAll(harpoons); | ||||
|         gameObjects.add(levelProgressBar); | ||||
|         gameObjects.add(levelLabel); | ||||
|         gameObjects.add(scoreLabel); | ||||
|         gameObjects.add(livesIcon); | ||||
|         gameObjects.add(player); | ||||
| 
 | ||||
|         levelProgressBar.addToCanvas(); | ||||
|         levelLabel.addToCanvas(); | ||||
|         scoreLabel.addToCanvas(); | ||||
|         livesIcon.addToCanvas(); | ||||
| 
 | ||||
|         player.addToCanvas(); | ||||
|         gameObjects.forEach(gameObject ->{ | ||||
|             gameObject.updatePosition(); | ||||
|             gameObject.updateStatus(); | ||||
|             gameObject.addToCanvas(); | ||||
|         }); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
| @ -83,4 +88,19 @@ class GameObjectManager { | ||||
|         return player; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Get the bubbles. | ||||
|      * @return the bubbles | ||||
|      */ | ||||
|     public LinkedList<Bubble> getBubbles() { | ||||
|         return bubbles; | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Get the harpoons. | ||||
|      * @return the harpoons | ||||
|      */ | ||||
|     public LinkedList<Harpoon> getHarpoons() { | ||||
|         return harpoons; | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -49,6 +49,13 @@ public abstract class GameObject { | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Updates the game object's status. | ||||
|      */ | ||||
|     public void updateStatus(){ | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|      * Set the responsible GamePlayManager. | ||||
|      * @param gamePlayManager the responsible GamePlayManager | ||||
| @ -64,4 +71,5 @@ public abstract class GameObject { | ||||
|     public Position getPosition(){ | ||||
|         return position; | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  | ||||
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user