예제 #1
0
 private void logic(int delta) {
   ball.update(delta);
   bat.update(delta);
   if (ball.getX() <= bat.getX() + bat.getWidth()
       && ball.getX() >= bat.getX()
       && ball.getY() >= bat.getY()
       && ball.getY() <= bat.getY() + bat.getHeight()) {
     ball.setDX(0.3);
   }
 }
예제 #2
0
 private void setUpEntities() {
   bat = new Bat(10, (HEIGHT / 2 - 80 / 2), 10, 80);
   ball = new Ball(WIDTH / 2 - 10 / 2, HEIGHT / 2 - 10, 10, 10);
   ball.setDX(-.1);
 }
예제 #3
0
 private void render() {
   glClear(GL_COLOR_BUFFER_BIT);
   ball.draw();
   bat.draw();
 }