having trouble implementing the code that will make the ball wait for a click. I have implemented code that allows the restart through the click, but can't seem to do it from the start.
I have read and tried to work through all the similar posts on this and can't seem to grasp it.
Below is my code for when it hits the bottom of the window and waits to reset - which is within the main While loop: (I can have everything work smoothly except for the starting point)
while(velocityY == 0)
{
GMouseEvent click = waitForEvent(MOUSE_EVENT);
if(getEventType(click) == MOUSE_CLICKED)
{
velocityX = drand48()+2;
velocityY = drand48()+2;
move(ball, velocityX, velocityY);
}
}
I have noticed that people have been doing this in the loop that is: while (lives > 0 && bricks > 0)
I have tried implementing similar code in this while loop also.
Thanks,
Cormac