Advertisement
fosterbl

PongProcessing2Tester

Feb 25th, 2020
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.00 KB | None | 0 0
  1. Ball movingBall;
  2.  
  3. void setup() {
  4.   size(640, 480);
  5.  
  6.   Ball one = new Ball();
  7.   System.out.println(one);
  8.  
  9.   Ball two = new Ball(100, 90, 10, 10);
  10.   System.out.println(two);
  11.  
  12.   Ball three = new Ball(100, 100, 30, 50);
  13.   System.out.println(three);
  14.  
  15.   Ball four = new Ball(100, 100, 30, 50, color(0, 0, 255));
  16.   System.out.println(four);
  17.  
  18.   Ball five = new Ball(100, 100, 30, 50, color(0, 0, 255), 5, 6);
  19.   System.out.println(five);
  20.  
  21.   //x, y, wid, ht, color, xSpd, ySpd
  22.   Ball six = new Ball(100, 100, 30, 50, color(0, 0, 255), 5, 6);
  23.   System.out.println(six);    
  24.  
  25.   System.out.println(five.equals(four));    
  26.  
  27.   System.out.println(five.equals(five));
  28.  
  29.   movingBall = new Ball();
  30. }
  31.  
  32. void draw() {
  33.   background(255);
  34.   movingBall.moveAndDisplay();
  35.  
  36.   if (!(movingBall.getX()>=10 && movingBall.getX()<=550))
  37.   {
  38.     movingBall.setXSpeed(-movingBall.getXSpeed());
  39.   }
  40.  
  41.   if (!(movingBall.getY()>=10 && movingBall.getY()<=450))
  42.   {
  43.     movingBall.setYSpeed(-movingBall.getYSpeed());
  44.   }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement