Example #1
0
  public ObsBall(int x, int y, int Rad, int sideDiff, int type) {
    this.x = x;
    this.y = y;
    this.rad = Rad;
    this.sideDiff = sideDiff;
    this.type = type;

    // hero 위치에 이만큼을 더해서, 그 범위 내에서는 장애물 생성 안되게 막으려고
    offsetFromHero = Rad * 25;

    // 속도 조절
    speed[0] = MainActivity.unitSpeed * 4;
    speed[1] = (int) (MainActivity.unitSpeed * 8);
    speed[2] = (int) (MainActivity.unitSpeed * 12);

    idx_speed = 0;

    // vx 정하기.
    vx = speed[idx_speed];
    vy = speed[idx_speed];

    if (Rnd.nextInt(1) == 0) vx *= -1;
    if (Rnd.nextInt(1) == 0) vy *= -1;
    //

    inCirclePnt = new Paint();
    inCirclePnt.setAntiAlias(true);
    if (type == TYPE_OBSTACLE) { // 장애물 볼
      red[0] = 135;
      green[0] = 206;
      blue[0] = 235;
      red[1] = 28;
      green[1] = 160;
      blue[1] = 217;
      red[2] = 16;
      green[2] = 94;
      blue[2] = 126;
      inCirclePnt.setColor(Color.rgb(red[idx_color], green[idx_color], blue[idx_color]));

    } else if (type == TYPE_ENERGY) { // 노란색 볼
      inCirclePnt.setColor(Color.rgb(243, 218, 150));

    } else if (type == ICE_OBSTACLE) { // 얼음 볼
      inCirclePnt.setColor(Color.WHITE);
    }

    outCirclePnt = new Paint();
    outCirclePnt.setAntiAlias(true);
    outCirclePnt.setColor(Color.BLACK);
    outCirclePnt.setStyle(Paint.Style.STROKE);
    outCirclePnt.setStrokeWidth(rad / 5);
  }
Example #2
0
  {
    listeners = new ArrayList<>();
    seriesRegistry = new ArrayList<>();
    renderers = new HashMap<>();

    borderPaint = new Paint();
    borderPaint.setColor(Color.rgb(150, 150, 150));
    borderPaint.setStyle(Paint.Style.STROKE);
    borderPaint.setStrokeWidth(1.0f);
    borderPaint.setAntiAlias(true);
    backgroundPaint = new Paint();
    backgroundPaint.setColor(Color.DKGRAY);
    backgroundPaint.setStyle(Paint.Style.FILL);
  }