top of page
Back

​Project 8

- Project Description -

Processing

    We collaborated with the D-Light group to designed and implemented a breathing training game system, exploring ways to use music as their primary guiding element to improve their lung capacity and provide stable and sustained support for their speech.

    In the game design section, we broke it down into three steps: 1) Pre-training and guidance; 2) Customization; 3) Exhalation training stage. In the pre-training and guidance stage, the game will guide the children to do one light blow and three deep exhalation through some text prompts, so as to obtain the children's current breathing state and the value of vital capacity, which can be used as the data reference for subsequent training. At the same time, the children will be introduced to the gameplay of the game through a short game guide.

- Code -

.........

void draw() {

if (page_status == 1 ) {
//m_start.play();
background(#8ed2f4);
noStroke();
//n=10;
for (int i = 0; i < n; i++) {
pingpong(i);
fill(c[i]);
image(bubble, x[i], y[i], d[i]/2, d[i]/2);
image(bubble_beats, width/2-bubble_beats.width/2, height/2-bubble_beats.height*0.8);
image(page1_blow, width/2-page1_blow.width/2, height*0.7);
}

if (mousePressed) {
page_status=2;
}
} else if (page_status == 2 ) {
m_start.pause();
background(#8ed2f4);
n=5;
for (int i = 0; i < n; i++) {
pingpong(i);
fill(c[i]);
image(bubble, x[i], y[i], d[i]/2, d[i]/2);
image(rabbit_train, width*0.08, height/4);
image(skip, width*0.8, height*0.7);
}
//print(balls.size());
for (int i = balls.size()-1; i >= 0; i--) {
// An ArrayList doesn't know what it is storing so we have to cast the object coming out
Ball ball = balls.get(i);
//if the ball is released
if (balls_situation.get(i)==0) { // 1 blowing 0
//if (p2_po_t <= 10){
// p2_po_t ++ ;
ball.display();
// //image(bubble_po, width-bubble_po.width/2, height-bubble_po.height/2,y-w/2, w, w);
// //ball.bubble_po();
//} else {
// p2_po_t =0;
//}
//ball.finished();
} else {
ball.display();
ball.bigger();
}
}
//print(train_status);
if (train_status == 1) {
image(blow_lightly, width/2-blow_lightly.width/2, height/15);
} else if (train_status == 2) {
image(blow_a_bigger, width/2-blow_a_bigger.width/2, height/15);
} else if ( train_status == 3) {
//print(train_status3_time);
if (train_status3_time <= 30 ) {
image(good_job, width/2-good_job.width/2, height/15);
train_status3_time ++;
} else {
image(try_again, width/2-try_again.width/2, height/15);
}
} else if (train_status == 4) {
image(blow_slowly, width/2-blow_slowly.width/2, height/15);
} else if (train_status == 5) {
if (train_status5_time <= 30) {
train_status5_time ++;
image(this_is_guide_bubble, width/2-this_is_guide_bubble.width/2, height/15);
} else {
image(try_to_blow, width/2-try_to_blow.width/2, height/15);
}
train.train_ball_small();
} else if (train_status == 6) {
image(try_again, width/2-try_again.width/2, height/15);
train.train_ball_big();
} else if (train_status == 7) {
page_status = 3 ;
}
}

......此处省略几百行......

class Train {

  void train_ball_small() {
    image(bubble_down, width/2-radius_small/2, height/2-radius_small/2, radius_small, radius_small);
    show_bubble_up = true ;
    bubble_up_a = 200 ;
    //t2=0;

    if (show_bubble_up == true) {
      if (t2<1.5) {
        tint(255, bubble_up_a);
        image(bubble_up, width/2-radius_small/2, height/2-radius_small/2, radius_small, radius_small);
        t2++;
        bubble_up_a = bubble_up_a -10 ;
      } else if (t2>=1.5 && t2 < 8.6 ) {
        t2++;
      } else if (t2>= 8.6) {
        t2=0;
        bubble_up_a = 200 ;
      }
    }
  }
 
  void train_ball_big() {
    image(bubble_down, width/2-radius_big/2, height/2-radius_big/2, radius_big, radius_big);
    show_bubble_up = true ;
    bubble_up_a = 200 ;
    //t2=0;
    if (show_bubble_up == true) {
      if (t2<1.5) {
        tint(255, bubble_up_a);
        image(bubble_up, width/2-radius_big/2, height/2-radius_big/2, radius_big, radius_big);
        t2++;
        bubble_up_a = bubble_up_a -10 ;
      } else if (t2>=1.5 && t2 <7 ) {
        t2++;
      } else if (t2>=7) {
        t2=0;
        bubble_up_a = 200 ;
      }
    }
  }
}

bottom of page