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); } }
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); }
private void render() { glClear(GL_COLOR_BUFFER_BIT); ball.draw(); bat.draw(); }