bird

Dependencies:   mbed

Revision:
0:3887ebee1b37
Child:
2:fb9c05867677
diff -r 000000000000 -r 3887ebee1b37 structure_2/structure_2.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/structure_2/structure_2.cpp	Fri May 03 17:51:38 2019 +0000
@@ -0,0 +1,91 @@
+#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++;
+        }
+
+        
+}
+
+
+
+
+
+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;
+}
+
+
+
+
+
+
+