Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Ball movingBall;
- void setup() {
- size(640, 480);
- Ball one = new Ball();
- System.out.println(one);
- Ball two = new Ball(100, 90, 10, 10);
- System.out.println(two);
- Ball three = new Ball(100, 100, 30, 50);
- System.out.println(three);
- Ball four = new Ball(100, 100, 30, 50, color(0, 0, 255));
- System.out.println(four);
- Ball five = new Ball(100, 100, 30, 50, color(0, 0, 255), 5, 6);
- System.out.println(five);
- //x, y, wid, ht, color, xSpd, ySpd
- Ball six = new Ball(100, 100, 30, 50, color(0, 0, 255), 5, 6);
- System.out.println(six);
- System.out.println(five.equals(four));
- System.out.println(five.equals(five));
- movingBall = new Ball();
- }
- void draw() {
- background(255);
- movingBall.moveAndDisplay();
- if (!(movingBall.getX()>=10 && movingBall.getX()<=550))
- {
- movingBall.setXSpeed(-movingBall.getXSpeed());
- }
- if (!(movingBall.getY()>=10 && movingBall.getY()<=450))
- {
- movingBall.setYSpeed(-movingBall.getYSpeed());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement