Mochu Yao explorer game

Dependencies:   mbed

Revision:
3:672d4bd8225d
Parent:
2:89f04cd3bf45
Child:
8:201ef0618b7d
--- a/item/item.h	Mon Apr 20 08:31:02 2020 +0000
+++ b/item/item.h	Tue Apr 21 12:31:27 2020 +0000
@@ -3,70 +3,12 @@
 
 #include "mbed.h"
 
-/** item Class
-* @the item class has three functions
-  1 generate an item in random position after one disappear
-  2 build the item's structer
-  3 build a barrier to increase difficulty
-* @date April 13th 2020
-* @author Yaomochu
-
-@code
-
-#include "mbed.h"
-#include "item.h"
-#include "Gamepad.h"
-#include "N5110.h"
-#include <cstdlib>
-#include <ctime>
-
-N5110 lcd(PTC9,PTC0,PTC7,PTD2,PTD1,PTC11);
-Gamepad gamepad;
-item _item;
-
-int _explorer_x;
-int _explorer_y;
-int _score;
-bool _collision_flag;
-
-int main()
-{
-  _item.init();
-  _explorer_x = 40;
-  _explorer_y = 15;
-  _player_score = 0;
-  srand(time(NULL));%this srand comment reqire the coin to get a random location value
-
-  while(1){
-  // If the player collides with the item,a flag will be set to run the interruprtion. player's score will be +1
-    if (_explorer_x == _item.get_x()&&(_explorer_y == _item.get_y() - 5))
-   {
-    _collision_flag = true;
-    _score++;
-  // the item will have a new random position and make a noise.
-    _item.set_item((rand()%100),(abs(rand()%100 - 10)));
-  // Place item on a constrained random position.
-    gamepad.tone(2000, 0.05);  // Make collection noise on buzzer.
-    
-// If the player collides with the barrier,a flag will be set to run the interruprtion. player's score will be -1
-    if (_explorer_x == _barrier.get_x()&&(_explorer_y == _barrier.get_y() - 5))
-   {
-    _collision_flag = true;
-    _score--;
-  // the barrier will have a new random position and make a noise.
-    _item.set_barrier((rand()%100),(abs(rand()%100 - 10)));
-  // Place barrier on a constrained random position.
-    gamepad.tone(3000, 0.05);  // Make collection noise on buzzer.
-    }
-
-    // than draw the next item on the lcd.
-    lcd.drawSprite(_item.get_x(),_item.get_y(),6,5,(int*)_item.get_item_sprite());
-    lcd.drawSprite(_barrier.get_x(),_barrier.get_y(),7,7,(int*)_barrier.get_barrier_sprite());
-  }
-}
-
-@endcode
-*/
+//* @the item file has three functions
+//  1 generate an item in random position after one disappear
+// 2 build the item's structer
+// 3 build a barrier to increase difficulty
+//* @date April 13th 2020
+//* @author Yaomochu
 
 class item
 {
@@ -82,22 +24,16 @@
     //Sets the item coordinates.
     //rand_x = a random number that determines the x coordinate
     //rand_y = a random number that determines if the item's generated level
-    void set_item(int rand_x, int rand_y);
-    void set_barrier(int rand_dx, int rand_dy);
-    int *get_item_sprite();
+    void set_item(int random_x, int random_y);
+    int *get_item_form();// rotating 
     int get_item_x();
     int get_item_y();
-    int *get_barrier_sprite();
-    int get_barrier_bx();
-    int get_barrier_by();
 
 
 private:
-    int _x;
-    int _y;
-    int _bx;
-    int _by;
-    int _loop;
-    bool _rotate_item;
+    int _x;//the x coordinate of the item
+    int _y;//the y coordinate of the item
+    int _loop;//the loop is used for the item to rotating which means after a few loop it will change it's form
+    bool _rotate_item;//when the loop reach a certain value the bool situation will determine if it will rotate 
 };
 #endif
\ No newline at end of file