Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void run() {
- try {
- Robot robot = new Robot();
- int y = ball.positionY + 50;
- int x = ball.positionX + 25;
- System.out.println(ball.positionX);
- System.out.println(ball.positionY);
- color = robot.getPixelColor(x, y);
- System.out.println("Red = " + color.getRed());
- System.out.println("Green = " + color.getGreen());
- System.out.println("Blue = " + color.getBlue());
- } catch (AWTException e) {
- e.printStackTrace();
- }
- if((color.getRed() == 0) && (color.getGreen() == 0) && (color.getBlue() == 255)){
- moveDown.cancel();
- moving = false;
- }
- else{
- ball.positionY += 5;
- if (ball.positionY > 670) {
- ball.positionY = 0;
- }
- }
- ball.repaint();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement