Mochu Yao explorer game

Dependencies:   mbed

Revision:
32:47d98959b4ef
Parent:
17:1b4ecc01b79f
Child:
33:ea83f08fa466
--- a/Surface/surface.cpp	Wed Apr 29 04:49:10 2020 +0000
+++ b/Surface/surface.cpp	Wed Apr 29 12:19:12 2020 +0000
@@ -40,30 +40,31 @@
 //3 makesure there are two surface for player to stay
 void Surface::line_1() {
     if(_line_1.left > 0) {
-        _line_1.left-- ;}
+        _line_1.left-- ;
+        wait(1);}
         //the left side will keep moving until it disappear on the screen which also means equal to zero
     if (_line_1.left + _line_1.length < 80) {
-        _line_1.right-- ;}
+        _line_1.right-- ; wait(1);}
         //this line is mainly for regeneration of the line because I want the line to first disapper and then appear on the another edge
     if (_line_1.right <= 0) { 
-        _line_1.right--;
+        _line_1.right--; wait(1)
         _line_1.left = 0; }
         //if the left edge of the line is zero it will keep zero until the right edge equals to zero
     if (_line_1.right <= 0) {
             _line_1.left = 80;
             _line_1.right = 80;}
-    _line_1.length = (rand() %10) + 10; } 
+    _line_1.length = (rand() %10) + 5; } 
 
 void Surface::line_2() {
     if(_line_2.left > 0) {
-        _line_2.left-- ;}
+        _line_2.left-- ; wait(1);}
         //the left side will keep moving until it disappear on the screen which also means equal to zero
     if (_line_2.left + _line_1.length < 80) {
-        _line_2.right-- ;}
+        _line_2.right-- ;wait(1);}
         //this line is mainly for regeneration of the line because I want the line to first disapper and then appear on the another edge
     if (_line_2.right <= 0) { 
         _line_2.right--;
-        _line_2.left = 0; }
+        _line_2.left = 0;wait(1);}
         //if the left edge of the line is zero it will keep zero until the right edge equals to zero
     if (_line_2.right <= 0) {
             _line_2.left = 80;
@@ -72,67 +73,67 @@
             
 void Surface::line_3() {
     if(_line_3.left > 0) {
-        _line_3.left-- ;}
+        _line_3.left-- ;wait(1);}
         //the left side will keep moving until it disappear on the screen which also means equal to zero
     if (_line_3.left + _line_1.length < 80) {
-        _line_3.right-- ;}
+        _line_3.right-- ;wait(1);}
         //this line is mainly for regeneration of the line because I want the line to first disapper and then appear on the another edge
     if (_line_3.right <= 0) { 
         _line_3.right--;
-        _line_3.left = 0; }
+        _line_3.left = 0; wait(1);}
         //if the left edge of the line is zero it will keep zero until the right edge equals to zero
     if (_line_3.right <= 0) {
             _line_3.left = 80;
             _line_3.right = 80;}
-    _line_3.length = (rand() %15) + 10; }
+    _line_3.length = (rand() %10) + 10; }
             
 void Surface::line_4() {
     if(_line_4.left > 0) {
-        _line_4.left-- ;}
+        _line_4.left-- ;wait(1);}
         //the left side will keep moving until it disappear on the screen which also means equal to zero
     if (_line_4.left + _line_1.length < 80) {
-        _line_4.right-- ;}
+        _line_4.right-- ;wait(1);}
         //this line is mainly for regeneration of the line because I want the line to first disapper and then appear on the another edge
     if (_line_4.right <= 0) { 
         _line_4.right--;
-        _line_4.left = 0; }
+        _line_4.left = 0;wait(1);}
         //if the left edge of the line is zero it will keep zero until the right edge equals to zero
     if (_line_4.right <= 0) {
             _line_4.left = 80;
             _line_4.right = 80;}
-    _line_4.length = (rand() %15) + 10; }
+    _line_4.length = (rand() %10) + 10; }
             
 void Surface::line_5() {
     if(_line_5.left > 0) {
         _line_5.left-- ;}
         //the left side will keep moving until it disappear on the screen which also means equal to zero
     if (_line_5.left + _line_1.length < 80) {
-        _line_5.right-- ;}
+        _line_5.right-- ;wait(1);}
         //this line is mainly for regeneration of the line because I want the line to first disapper and then appear on the another edge
     if (_line_5.right <= 0) { 
         _line_5.right--;
-        _line_5.left = 0; }
+        _line_5.left = 0;wait(1);}
         //if the left edge of the line is zero it will keep zero until the right edge equals to zero
     if (_line_5.right <= 0) {
             _line_5.left = 80;
             _line_5.right = 80;}
-    _line_5.length = (rand() %15) + 10; }
+    _line_5.length = (rand() %10) + 5; }
             
 void Surface::line_6() {
     if(_line_6.left > 0) {
-        _line_6.left-- ;}
+        _line_6.left-- ;wait(1);}
         //the left side will keep moving until it disappear on the screen which also means equal to zero
     if (_line_6.left + _line_1.length < 80) {
-        _line_6.right-- ;}
+        _line_6.right-- ;wait(1);}
         //this line is mainly for regeneration of the line because I want the line to first disapper and then appear on the another edge
     if (_line_6.right <= 0) { 
         _line_6.right--;
-        _line_6.left = 0; }
+        _line_6.left = 0;wait(1);}
         //if the left edge of the line is zero it will keep zero until the right edge equals to zero
     if (_line_6.right <= 0) {
             _line_6.left = 80;
             _line_6.right = 80;}
-    _line_6.length = (rand() %15) + 10; }
+    _line_6.length = (rand() %10) + 10; }
 
 Line Surface::getline_1(){return _line_1;}
 Line Surface::getline_2(){return _line_2;}