Programmierung 2 - Praktikum
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
1.2 KiB

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);
LevelWithBox myLevel = this;
RectObject Object = new RectObject(id,myLevel,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!";
}
}