0

I tried this but of no use

if(getY(ball)+getHeight(ball)>=getHeight(window))
{
    lives=LIVES-1;
    removeGWindow(window,ball);
    GOval ball=initBall(window);
    stop= 1;

    //setLocation(ball, 190, 300);
}

if(stop==1 && event!= NULL && getEventType(event)==MOUSE_CLICKED)
{
    move(ball, 0, velocity);
    velocity=drand48();
    speed=drand48();
    move(ball,velocity,speed);
    stop=0;

1 Answer 1

1

Move it the same way you move it through the rest of the program, but in this particular case you want to move it to the same place you placed it initially, and wait for click before continuing. That is already done in your code also.

4
  • but its not working Sean
    – Paurush
    Jun 18, 2014 at 7:11
  • If the code you use to move the ball, specifically setLocation() were not working, the ball would never reach the bottom of the window; additionally, the default behavior has the program wait for a click after all of the objects are instantiated and variables declared. It should be on or around line 73 I believe. So you don't have to worry about writing code to wait for click, you just have to move the ball, which you know how to do, and then waitForClick() Jun 18, 2014 at 7:15
  • after using it also its of no use . No change
    – Paurush
    Jun 18, 2014 at 7:17
  • Don't give up! You can do this, you're so close. I am going to sleep for the night, but have added icq info to my about section, feel free to shoot me a message if you're still having issues and I'll try to be more helpful Jun 18, 2014 at 8:10

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .