Beispiel #1
0
  // 새로운 볼 생성
  static Ball Create(int x, int y, int Rad) {
    Random Rnd = new Random();
    Ball NewBall = new Ball();

    NewBall.x = x;
    NewBall.y = y;
    NewBall.rad = Rad;
    do {
      NewBall.dx = Rnd.nextInt(11) - 5;
      NewBall.dy = Rnd.nextInt(11) - 5;
    } while (NewBall.dx == 0 || NewBall.dy == 0);

    NewBall.count = 0;
    NewBall.color = Color.rgb(Rnd.nextInt(256), Rnd.nextInt(256), Rnd.nextInt(256));

    return NewBall;
  }