bird

Dependencies:   mbed

Committer:
1013373474
Date:
Fri May 03 17:51:38 2019 +0000
Revision:
0:3887ebee1b37
Child:
2:fb9c05867677
fly bird

Who changed what in which revision?

UserRevisionLine numberNew contents of line
1013373474 0:3887ebee1b37 1 #include "structure_2.h"
1013373474 0:3887ebee1b37 2
1013373474 0:3887ebee1b37 3 void structure_2::init(){
1013373474 0:3887ebee1b37 4 _mm = 41;
1013373474 0:3887ebee1b37 5 _pp = 71;
1013373474 0:3887ebee1b37 6 _ee = 101;
1013373474 0:3887ebee1b37 7 _nn = 12;
1013373474 0:3887ebee1b37 8 _qq = 19;
1013373474 0:3887ebee1b37 9 _oo = 17;
1013373474 0:3887ebee1b37 10 _tt = 0;
1013373474 0:3887ebee1b37 11 }
1013373474 0:3887ebee1b37 12
1013373474 0:3887ebee1b37 13 void structure_2::draw(N5110 &lcd)
1013373474 0:3887ebee1b37 14 {
1013373474 0:3887ebee1b37 15
1013373474 0:3887ebee1b37 16
1013373474 0:3887ebee1b37 17 _nn = rand() % (20-5+1)+ 5;
1013373474 0:3887ebee1b37 18
1013373474 0:3887ebee1b37 19
1013373474 0:3887ebee1b37 20 _qq = rand() % (20-5+1)+ 5;
1013373474 0:3887ebee1b37 21
1013373474 0:3887ebee1b37 22
1013373474 0:3887ebee1b37 23 _oo = rand() % (20-5+1)+ 5;
1013373474 0:3887ebee1b37 24
1013373474 0:3887ebee1b37 25
1013373474 0:3887ebee1b37 26
1013373474 0:3887ebee1b37 27
1013373474 0:3887ebee1b37 28 lcd.drawRect(_mm,_nn+15,5,33-_nn,FILL_BLACK);//该公式前两个点是坐标,后两个点是涂抹区域的长宽,先长后宽,障碍物中间的间隔是10
1013373474 0:3887ebee1b37 29 lcd.drawRect(_mm,0,5,_nn,FILL_BLACK);//the higher
1013373474 0:3887ebee1b37 30
1013373474 0:3887ebee1b37 31 lcd.drawRect(_pp,0,5,_qq,FILL_BLACK);
1013373474 0:3887ebee1b37 32 lcd.drawRect(_pp,_qq+15,5,33-_qq,FILL_BLACK);
1013373474 0:3887ebee1b37 33
1013373474 0:3887ebee1b37 34 lcd.drawRect(_ee,0,5,_oo,FILL_BLACK);
1013373474 0:3887ebee1b37 35 lcd.drawRect(_ee,_oo+15,5,33-_oo,FILL_BLACK);
1013373474 0:3887ebee1b37 36 lcd.refresh();
1013373474 0:3887ebee1b37 37
1013373474 0:3887ebee1b37 38
1013373474 0:3887ebee1b37 39
1013373474 0:3887ebee1b37 40 _mm -= 2;
1013373474 0:3887ebee1b37 41 _pp -= 2;
1013373474 0:3887ebee1b37 42 _ee -= 2;
1013373474 0:3887ebee1b37 43
1013373474 0:3887ebee1b37 44
1013373474 0:3887ebee1b37 45 if ( _mm == 1 ){
1013373474 0:3887ebee1b37 46 _mm = _ee + 30;
1013373474 0:3887ebee1b37 47 }
1013373474 0:3887ebee1b37 48 if ( _pp == 1 ){
1013373474 0:3887ebee1b37 49 _pp = _mm + 30;
1013373474 0:3887ebee1b37 50 }
1013373474 0:3887ebee1b37 51 if ( _ee == 1 ){
1013373474 0:3887ebee1b37 52 _ee = _pp + 30;
1013373474 0:3887ebee1b37 53 } //xun huan
1013373474 0:3887ebee1b37 54
1013373474 0:3887ebee1b37 55
1013373474 0:3887ebee1b37 56
1013373474 0:3887ebee1b37 57 if ( _mm == 31 ){
1013373474 0:3887ebee1b37 58 _tt = _tt++;
1013373474 0:3887ebee1b37 59 }
1013373474 0:3887ebee1b37 60 if ( _pp == 31 ){
1013373474 0:3887ebee1b37 61 _tt = _tt++;
1013373474 0:3887ebee1b37 62 }
1013373474 0:3887ebee1b37 63 if ( _ee == 31 ){
1013373474 0:3887ebee1b37 64 _tt = _tt++;
1013373474 0:3887ebee1b37 65 }
1013373474 0:3887ebee1b37 66
1013373474 0:3887ebee1b37 67
1013373474 0:3887ebee1b37 68 }
1013373474 0:3887ebee1b37 69
1013373474 0:3887ebee1b37 70
1013373474 0:3887ebee1b37 71
1013373474 0:3887ebee1b37 72
1013373474 0:3887ebee1b37 73
1013373474 0:3887ebee1b37 74 Data2 structure_2::get_data2()
1013373474 0:3887ebee1b37 75 {
1013373474 0:3887ebee1b37 76 _data2.mm = _mm;
1013373474 0:3887ebee1b37 77 _data2.pp = _pp;
1013373474 0:3887ebee1b37 78 _data2.ee = _ee;
1013373474 0:3887ebee1b37 79 _data2.nn = _nn;
1013373474 0:3887ebee1b37 80 _data2.qq = _qq;
1013373474 0:3887ebee1b37 81 _data2.oo = _oo;
1013373474 0:3887ebee1b37 82 _data2.tt = _tt; // 分数
1013373474 0:3887ebee1b37 83 return _data2;
1013373474 0:3887ebee1b37 84 }
1013373474 0:3887ebee1b37 85
1013373474 0:3887ebee1b37 86
1013373474 0:3887ebee1b37 87
1013373474 0:3887ebee1b37 88
1013373474 0:3887ebee1b37 89
1013373474 0:3887ebee1b37 90
1013373474 0:3887ebee1b37 91