Advertisement
fernandoReyna

bounce4

Jun 11th, 2015
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.77 KB | None | 0 0
  1. // keep playing until game over
  2.     while (lives > 0 && bricks > 0)
  3.     {
  4.         // TODO
  5.         double velocity  = 2.15;
  6.         while(true)
  7.          {
  8.          move(circle,velocity,velocity);
  9.            if (getX(circle) + getWidth(circle) >= getWith(window))
  10.            {
  11.            velocity = -velocity;
  12.            }
  13.            else if (getX(circle) <= 0 )
  14.            {
  15.            velocity = - velocity;
  16.            }
  17.            else if (getY(circle) <=0)
  18.            {
  19.            velocity = -velocity;
  20.            }
  21.            else if (getY(circle) >= 540)
  22.            {
  23.            velocity = -velocity;
  24.            }
  25.            pause(10);
  26.          }
  27.        
  28.     }
  29.  
  30.     // wait for click before exiting
  31.     waitForClick();tantiate bricks
  32.     initBricks(window);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement