|
|
@ -0,0 +1,43 @@ |
|
|
|
package playground; |
|
|
|
|
|
|
|
import gameobjects.RectObject; |
|
|
|
import java.awt.Color; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* The class creates its own level, which contains 2 methods |
|
|
|
* and takes methods from the SpaceInvadersLevel class as well as |
|
|
|
* from the RectObject class.The graphical content is changed here. |
|
|
|
* RectObject initialized with a suitable RectArtist to draw the RectObject. |
|
|
|
* |
|
|
|
* This class extends from {@link SpaceInvadersLife}. |
|
|
|
*/ |
|
|
|
public class LevelWithBox extends SpaceInvadersLevel { |
|
|
|
|
|
|
|
/** |
|
|
|
* |
|
|
|
* PrepareLevel |
|
|
|
* First sets up the layer and calls it every time it starts. |
|
|
|
* An object with transmitted parameters from RectObject is created. |
|
|
|
* addObject Method from the {@link Playground} class adds the graphics object to a level. |
|
|
|
* @param id - String unique name to be used. |
|
|
|
*/ |
|
|
|
public void prepareLevel(String id) { |
|
|
|
|
|
|
|
super.prepareLevel(id); |
|
|
|
RectObject Object = new RectObject(id,null,350,100,0,0,700,250,Color.RED); |
|
|
|
this.addObject(Object); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Returns the text that should be displayed at the beginning of the game. |
|
|
|
* |
|
|
|
* @return a string that is displayed at the beginning. It should be not longer than 30 characters. |
|
|
|
*/ |
|
|
|
protected String getStartupMessage() { |
|
|
|
return "Box-Level!"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|