Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. public void run() {
  2. try {
  3. Robot robot = new Robot();
  4. int y = ball.positionY + 50;
  5. int x = ball.positionX + 25;
  6.  
  7. System.out.println(ball.positionX);
  8. System.out.println(ball.positionY);
  9.  
  10. color = robot.getPixelColor(x, y);
  11.  
  12. System.out.println("Red = " + color.getRed());
  13. System.out.println("Green = " + color.getGreen());
  14. System.out.println("Blue = " + color.getBlue());
  15.  
  16. } catch (AWTException e) {
  17.  
  18. e.printStackTrace();
  19.  
  20. }
  21.  
  22. if((color.getRed() == 0) && (color.getGreen() == 0) && (color.getBlue() == 255)){
  23.  
  24. moveDown.cancel();
  25. moving = false;
  26.  
  27. }
  28. else{
  29. ball.positionY += 5;
  30. if (ball.positionY > 670) {
  31. ball.positionY = 0;
  32. }
  33. }
  34.  
  35. ball.repaint();
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement