Пример #1
0
  public Breakout() {
    top = new Wall(0, -5, 800, 10);
    left = new Wall(-5, 0, 10, 640);
    right = new Wall(795, 0, 10, 640);
    bottom = new Wall(0, 610, 800, 10);

    keys = new boolean[2];

    score = 0;
    lives = 5;

    ball = new Ball(400, 500);
    ball.setXSpeed(2);
    ball.setYSpeed(-2);

    paddle = new Paddle(400, 595, 100, 10, 5);

    bricks = getBricks("lvlTwo.txt");

    setBackground(Color.WHITE);
    setVisible(true);

    new Thread(this).start();
    addKeyListener(this); // starts the key thread to log key strokes
  }
Пример #2
0
  public void setupgamepage() {
    Graphics g = getGraphics();
    Threadnum = 0;
    setBackground(Color.black);

    keys = new boolean[5];

    // instantiate other stuff
    ship = new Ship(250, 400, 10); // 10 //20
    aliens = new ArrayList<Alien>();
    shots = new ArrayList<Ammo>();
    everything = new ArrayList<MovingThing>();
    ammosupply = 1000;
    canshoot = true;
    addclan = false;
    start = false;
    addmorealiens();
    this.addKeyListener(this);
    new Thread(this).start();
  }