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
864 B

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