package playground; import java.awt.Color; import gameobjects.RectObject; /** * extends {@link SpaceInvadersLevel} with a red box. * */ public class LevelWithBox extends SpaceInvadersLevel { /** * simply returns the text that should be displayed at level start. * * @return a string that is displayed at start. Should be not longer than 30 characters. */ @Override protected String getStartupMessage() { return "Box-Level!"; } /** * Method creates a new Object {@link gameobjects.RectObject} named RedBox. * calls method of {@link prepareLevel}. * Object added to the level. * @param String id to identify the level. */ @Override public void prepareLevel(String id) { super.prepareLevel(id); RectObject redBox = new RectObject("RedBox", this, 350, 100, 0, 0, 700, 250, Color.RED); this.addObject(redBox); } }