glutKeyboardFunc problem

Hi everybody,

I have a small issue to come over.

I have made a ball game which I kick a ball against a wall.

Basically what is meant to happen is when I press ‘z’ once the ball is meant to be kicked against the wall.

With this code I have done I have to hold onto ‘z’ the key in order for it to kick the ball against the wall.

In order to do this I need a timerFunction which needs to animate the ball and kick it against the wall, and if it hits the wall then the ball should retur back to where it started.

I have supplied the relevant code below:

GLfloat ballXpos = 40.0f;
GLfloat ballYpos = -30.0f;
GLfloat ballZpos = 160.0f;

void frontWall()
{
glBegin(GL_QUADS);
glVertex3f(-100.0, -50.0, -350.0);
glVertex3f(-100.0, 50.0, -350.0);
glVertex3f(100.0, 50.0, -350.0);
glVertex3f(100.0, -50.0, -350.0);
glEnd();
}

void normalKeys(unsigned char key, int x, int y) {
{

    if (key == 'z') {
        ballZpos = ballZpos - ballZspeed;
        ballYpos = ballYpos + 0.5f;
        glutPostRedisplay();
    }