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.

40 lines
1.0 KiB

  1. package playground;
  2. import java.awt.Color;
  3. import gameobjects.RectObject;
  4. /** This level adds two distracting objects to the canvas that cannot collide but bounce around all the time.
  5. */
  6. public class LevelMovingObjects extends SpaceInvadersLevel {
  7. // TODO your code here
  8. /** "Moving Objects Level!" is the message.
  9. *
  10. * @return String "Moving Objects Level!"
  11. */
  12. @Override
  13. protected String getStartupMessage() {
  14. return "Moving Objects Level!";
  15. }
  16. /** Prepares Level for LevelMovingObjects.
  17. * Adds a BlueBox & PinkBox in Level.
  18. *
  19. * @param String id LevelID
  20. */
  21. @Override
  22. public void prepareLevel(String id) {
  23. super.prepareLevel(id);
  24. RectObject BlueBox = new RectObject("BlueBox", this, 300, 300, 170, 70, 30, 30, Color.BLUE);
  25. this.addObject(BlueBox);
  26. BlueBox.addController(new controller.ReboundController());
  27. RectObject PinkBox = new RectObject("PinkBox", this, 200, 200, 50, 170, 30, 30, Color.PINK);
  28. this.addObject(PinkBox);
  29. PinkBox.addController(new controller.ReboundController());
  30. }
  31. }