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

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