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