private void input() { if (Keyboard.isKeyDown(Keyboard.KEY_UP)) { bat.setDY(-.2); } else if (Keyboard.isKeyDown(Keyboard.KEY_DOWN)) { bat.setDY(.2); } else { bat.setDY(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); } }
private void render() { glClear(GL_COLOR_BUFFER_BIT); ball.draw(); bat.draw(); }