31 ตุลาคม 2556

void random_Ball

สุ่มแนวการเดินลูกบอลที่ Boy ตี 




void random_Ball() {
  if (speed%ten_Go==0) {
    if (ten1_Boy==0||ten2_Boy==0&&ten1_Boy>4&&ten1_Boy<6) {
      float a = random(0, 3);
      if (a>0&&a<=1) {
        if (ten1_Boy==0) {
          ball = Ball_Boy[0].length;
          set_ten1 = 0;
          step = 0;
          ten1_Boy = 1;
        }
        else if (ten2_Boy==0) {
          ball2 = Ball_Boy[0].length;
          set_ten2 = 0;
          step2 = 0;
          ten2_Boy = 1;
        }
      }
      if (a<=2&&a>1) {
        if (ten1_Boy==0) {
          ball = Ball_Boy[2].length;
          set_ten1 = 1;
          step = 0;
          ten1_Boy = 1;
        }
        else if (ten2_Boy==0) {
          ball2 = Ball_Boy[2].length;
          set_ten2 = 1;
          step2 = 0;
          ten2_Boy = 1;
        }
      }
      if (a<=3&&a>2) {
        if (ten1_Boy==0) {
          ball = Ball_Boy[4].length;
          set_ten1 = 2;
          step = 0;
          ten1_Boy = 1;
        }
        else if (ten2_Boy==0) {
          ball2 = Ball_Boy[4].length;
          set_ten2 = 2;
          step2 = 0;
          ten2_Boy = 1;
        }
      }
    }
  }
}

ไม่มีความคิดเห็น:

แสดงความคิดเห็น