勇帜 周
/
2645_Final_project_1
bird
Diff: structure_2/structure_2.cpp
- Revision:
- 6:9bf0273ee25f
- Parent:
- 5:6be8521a885a
diff -r 6be8521a885a -r 9bf0273ee25f structure_2/structure_2.cpp --- a/structure_2/structure_2.cpp Mon May 06 04:55:51 2019 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,100 +0,0 @@ -#include "structure_2.h" - -void structure_2::init(){ - _mm = 41; - _pp = 71; - _ee = 101; - _nn = 12; - _qq = 19; - _oo = 17; - _tt = 0; - } - -void structure_2::draw(N5110 &lcd) -{ - - - _nn = rand() % (20-5+1)+ 5; - - - _qq = rand() % (20-5+1)+ 5; - - - _oo = rand() % (20-5+1)+ 5; - - - - - lcd.drawRect(_mm,_nn+15,5,33-_nn,FILL_BLACK);//该公式前两个点是坐标,后两个点是涂抹区域的长宽,先长后宽,障碍物中间的间隔是10 - lcd.drawRect(_mm,0,5,_nn,FILL_BLACK);//the higher - - lcd.drawRect(_pp,0,5,_qq,FILL_BLACK); - lcd.drawRect(_pp,_qq+15,5,33-_qq,FILL_BLACK); - - lcd.drawRect(_ee,0,5,_oo,FILL_BLACK); - lcd.drawRect(_ee,_oo+15,5,33-_oo,FILL_BLACK); - lcd.refresh(); - - - - _mm -= 2; - _pp -= 2; - _ee -= 2; - - - if ( _mm == 1 ){ - _mm = _ee + 30; - } - if ( _pp == 1 ){ - _pp = _mm + 30; - } - if ( _ee == 1 ){ - _ee = _pp + 30; - } //xun huan - - - - if ( _mm == 31 ){ - _tt = _tt++; - } - if ( _pp == 31 ){ - _tt = _tt++; - } - if ( _ee == 31 ){ - _tt = _tt++; - } - if ( _mm <= 15 ){ - _nn =0 ; - } - if ( _pp <= 15 ){ - _qq =0 ; - } - if ( _ee <= 15 ){ - _oo =0 ; - } - - -} - - - - - -Data2 structure_2::get_data2() -{ - _data2.mm = _mm; - _data2.pp = _pp; - _data2.ee = _ee; - _data2.nn = _nn; - _data2.qq = _qq; - _data2.oo = _oo; - _data2.tt = _tt; // 分数 - return _data2; -} - - - - - - -