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.

38 lines
884 B

2 years ago
  1. package playground;
  2. import java.awt.Color;
  3. import gameobjects.RectObject;
  4. /**
  5. * created by Jannik
  6. * extends {@link SpaceInvadersLevel} with a red box.
  7. *
  8. */
  9. public class LevelWithBox extends SpaceInvadersLevel {
  10. /**
  11. * simply returns the text that should be displayed at level start.
  12. *
  13. * @return a string that is displayed at start. Should be not longer than 30 characters.
  14. */
  15. @Override
  16. protected String getStartupMessage() {
  17. return "Box-Level!";
  18. }
  19. /**
  20. * Method creates a new Object {@link gameobjects.RectObject} named RedBox.
  21. * calls method of {@link prepareLevel}.
  22. * Object added to the level.
  23. * @param String id to identify the level.
  24. */
  25. @Override
  26. public void prepareLevel(String id) {
  27. super.prepareLevel(id);
  28. RectObject redBox = new RectObject("RedBox", this, 350, 100, 0, 0, 700, 250, Color.RED);
  29. this.addObject(redBox);
  30. }
  31. }