Package bouncingballs.BouncingBalls

Examples of bouncingballs.BouncingBalls.Ball


    // the random seed must be identical for all clients
    randomSeed(1);

    // add a "randomly" placed ball
    balls = new ArrayList<Ball>();
    Ball ball = new Ball(random(client.getMWidth()),
        random(client.getMHeight()));
    balls.add(ball);

  }
View Full Code Here


  public void dataEvent(TCPClient c) {
    String[] msg = c.getDataMessage();
    String[] xy = msg[0].split(",");
    float x = Integer.parseInt(xy[0]);
    float y = Integer.parseInt(xy[1]);
    balls.add(new Ball(x, y));
  }
View Full Code Here

    // clear the screen
    background(255);

    // move and draw all the balls
    for (int i = 0; i < balls.size(); i++) {
      Ball ball = (Ball) balls.get(i);
      ball.calc();
      if (client.isOnScreen(ball.x - ball.d / 2, ball.y - ball.d / 2,
          ball.d, ball.d)) {
        ball.draw();
      }
    }

    // You can also read incoming messages in frameEvent
    /*if (c.messageAvailable()) {
View Full Code Here

TOP

Related Classes of bouncingballs.BouncingBalls.Ball

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.