勇帜 周
/
2645_Final_project_1
bird
structure_2/structure2.cpp@6:9bf0273ee25f, 2019-05-06 (annotated)
- Committer:
- 1013373474
- Date:
- Mon May 06 05:02:25 2019 +0000
- Revision:
- 6:9bf0273ee25f
change the class name of structure_2.h file
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
1013373474 | 6:9bf0273ee25f | 1 | #include "structure2.h" |
1013373474 | 6:9bf0273ee25f | 2 | |
1013373474 | 6:9bf0273ee25f | 3 | void structure2::init(){ |
1013373474 | 6:9bf0273ee25f | 4 | _mm = 41; |
1013373474 | 6:9bf0273ee25f | 5 | _pp = 71; |
1013373474 | 6:9bf0273ee25f | 6 | _ee = 101; |
1013373474 | 6:9bf0273ee25f | 7 | _nn = 12; |
1013373474 | 6:9bf0273ee25f | 8 | _qq = 19; |
1013373474 | 6:9bf0273ee25f | 9 | _oo = 17; |
1013373474 | 6:9bf0273ee25f | 10 | _tt = 0; |
1013373474 | 6:9bf0273ee25f | 11 | } |
1013373474 | 6:9bf0273ee25f | 12 | |
1013373474 | 6:9bf0273ee25f | 13 | void structure2::draw(N5110 &lcd) |
1013373474 | 6:9bf0273ee25f | 14 | { |
1013373474 | 6:9bf0273ee25f | 15 | |
1013373474 | 6:9bf0273ee25f | 16 | |
1013373474 | 6:9bf0273ee25f | 17 | _nn = rand() % (20-5+1)+ 5; |
1013373474 | 6:9bf0273ee25f | 18 | |
1013373474 | 6:9bf0273ee25f | 19 | |
1013373474 | 6:9bf0273ee25f | 20 | _qq = rand() % (20-5+1)+ 5; |
1013373474 | 6:9bf0273ee25f | 21 | |
1013373474 | 6:9bf0273ee25f | 22 | |
1013373474 | 6:9bf0273ee25f | 23 | _oo = rand() % (20-5+1)+ 5; |
1013373474 | 6:9bf0273ee25f | 24 | |
1013373474 | 6:9bf0273ee25f | 25 | |
1013373474 | 6:9bf0273ee25f | 26 | |
1013373474 | 6:9bf0273ee25f | 27 | |
1013373474 | 6:9bf0273ee25f | 28 | lcd.drawRect(_mm,_nn+15,5,33-_nn,FILL_BLACK);//该公式前两个点是坐标,后两个点是涂抹区域的长宽,先长后宽,障碍物中间的间隔是10 |
1013373474 | 6:9bf0273ee25f | 29 | lcd.drawRect(_mm,0,5,_nn,FILL_BLACK);//the higher |
1013373474 | 6:9bf0273ee25f | 30 | |
1013373474 | 6:9bf0273ee25f | 31 | lcd.drawRect(_pp,0,5,_qq,FILL_BLACK); |
1013373474 | 6:9bf0273ee25f | 32 | lcd.drawRect(_pp,_qq+15,5,33-_qq,FILL_BLACK); |
1013373474 | 6:9bf0273ee25f | 33 | |
1013373474 | 6:9bf0273ee25f | 34 | lcd.drawRect(_ee,0,5,_oo,FILL_BLACK); |
1013373474 | 6:9bf0273ee25f | 35 | lcd.drawRect(_ee,_oo+15,5,33-_oo,FILL_BLACK); |
1013373474 | 6:9bf0273ee25f | 36 | lcd.refresh(); |
1013373474 | 6:9bf0273ee25f | 37 | |
1013373474 | 6:9bf0273ee25f | 38 | |
1013373474 | 6:9bf0273ee25f | 39 | |
1013373474 | 6:9bf0273ee25f | 40 | _mm -= 2; |
1013373474 | 6:9bf0273ee25f | 41 | _pp -= 2; |
1013373474 | 6:9bf0273ee25f | 42 | _ee -= 2; |
1013373474 | 6:9bf0273ee25f | 43 | |
1013373474 | 6:9bf0273ee25f | 44 | |
1013373474 | 6:9bf0273ee25f | 45 | if ( _mm == 1 ){ |
1013373474 | 6:9bf0273ee25f | 46 | _mm = _ee + 30; |
1013373474 | 6:9bf0273ee25f | 47 | } |
1013373474 | 6:9bf0273ee25f | 48 | if ( _pp == 1 ){ |
1013373474 | 6:9bf0273ee25f | 49 | _pp = _mm + 30; |
1013373474 | 6:9bf0273ee25f | 50 | } |
1013373474 | 6:9bf0273ee25f | 51 | if ( _ee == 1 ){ |
1013373474 | 6:9bf0273ee25f | 52 | _ee = _pp + 30; |
1013373474 | 6:9bf0273ee25f | 53 | } //xun huan |
1013373474 | 6:9bf0273ee25f | 54 | |
1013373474 | 6:9bf0273ee25f | 55 | |
1013373474 | 6:9bf0273ee25f | 56 | |
1013373474 | 6:9bf0273ee25f | 57 | if ( _mm == 31 ){ |
1013373474 | 6:9bf0273ee25f | 58 | _tt = _tt++; |
1013373474 | 6:9bf0273ee25f | 59 | } |
1013373474 | 6:9bf0273ee25f | 60 | if ( _pp == 31 ){ |
1013373474 | 6:9bf0273ee25f | 61 | _tt = _tt++; |
1013373474 | 6:9bf0273ee25f | 62 | } |
1013373474 | 6:9bf0273ee25f | 63 | if ( _ee == 31 ){ |
1013373474 | 6:9bf0273ee25f | 64 | _tt = _tt++; |
1013373474 | 6:9bf0273ee25f | 65 | } |
1013373474 | 6:9bf0273ee25f | 66 | if ( _mm <= 15 ){ |
1013373474 | 6:9bf0273ee25f | 67 | _nn =0 ; |
1013373474 | 6:9bf0273ee25f | 68 | } |
1013373474 | 6:9bf0273ee25f | 69 | if ( _pp <= 15 ){ |
1013373474 | 6:9bf0273ee25f | 70 | _qq =0 ; |
1013373474 | 6:9bf0273ee25f | 71 | } |
1013373474 | 6:9bf0273ee25f | 72 | if ( _ee <= 15 ){ |
1013373474 | 6:9bf0273ee25f | 73 | _oo =0 ; |
1013373474 | 6:9bf0273ee25f | 74 | } |
1013373474 | 6:9bf0273ee25f | 75 | |
1013373474 | 6:9bf0273ee25f | 76 | |
1013373474 | 6:9bf0273ee25f | 77 | } |
1013373474 | 6:9bf0273ee25f | 78 | |
1013373474 | 6:9bf0273ee25f | 79 | |
1013373474 | 6:9bf0273ee25f | 80 | |
1013373474 | 6:9bf0273ee25f | 81 | |
1013373474 | 6:9bf0273ee25f | 82 | |
1013373474 | 6:9bf0273ee25f | 83 | Data2 structure2::get_data2() |
1013373474 | 6:9bf0273ee25f | 84 | { |
1013373474 | 6:9bf0273ee25f | 85 | _data2.mm = _mm; |
1013373474 | 6:9bf0273ee25f | 86 | _data2.pp = _pp; |
1013373474 | 6:9bf0273ee25f | 87 | _data2.ee = _ee; |
1013373474 | 6:9bf0273ee25f | 88 | _data2.nn = _nn; |
1013373474 | 6:9bf0273ee25f | 89 | _data2.qq = _qq; |
1013373474 | 6:9bf0273ee25f | 90 | _data2.oo = _oo; |
1013373474 | 6:9bf0273ee25f | 91 | _data2.tt = _tt; // 分数 |
1013373474 | 6:9bf0273ee25f | 92 | return _data2; |
1013373474 | 6:9bf0273ee25f | 93 | } |
1013373474 | 6:9bf0273ee25f | 94 | |
1013373474 | 6:9bf0273ee25f | 95 | |
1013373474 | 6:9bf0273ee25f | 96 | |
1013373474 | 6:9bf0273ee25f | 97 | |
1013373474 | 6:9bf0273ee25f | 98 | |
1013373474 | 6:9bf0273ee25f | 99 | |
1013373474 | 6:9bf0273ee25f | 100 |